102e05c8ba
Adds a full simulation harness (game-simulation package) with greedy/random strategies, 36-metric diagnostics, multi-run orchestration via child processes, and a statistical interpreter. Includes 2.3x engine performance optimizations (research bonus caching, per-DC dirty tracking, reduced allocations in tick pipeline, single-pass loops). Fixes a critical balance bug where training pipelines stalled on insufficient VRAM would permanently block training slots — the engine never re-checked stalled pipelines, and the greedy strategy didn't pre-check VRAM requirements. This caused 20-25% of seeds to get stuck in Scale-up era. All three fixes (engine un-stalling, strategy VRAM pre-check, stalled pipeline cancellation) bring pass rate from 75% to 100% across 20 random seeds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
24 lines
569 B
TypeScript
24 lines
569 B
TypeScript
export interface SeededRNG {
|
|
random(): number;
|
|
install(): void;
|
|
uninstall(): void;
|
|
}
|
|
|
|
export function createSeededRNG(seed: number): SeededRNG {
|
|
let state = seed | 0;
|
|
const originalRandom = Math.random;
|
|
|
|
function random(): number {
|
|
state = (state + 0x6D2B79F5) | 0;
|
|
let t = Math.imul(state ^ (state >>> 15), 1 | state);
|
|
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
}
|
|
|
|
return {
|
|
random,
|
|
install() { Math.random = random; },
|
|
uninstall() { Math.random = originalRandom; },
|
|
};
|
|
}
|