import { describe, expect, it } from 'vitest' import { stateFingerprint, longRun } from './fingerprint.helper' import { World } from '../src/renderer/game/engine/runtime/World' /** * 金钟罩:固定种子长跑 560 月的状态指纹。 * 任何改动(重构日程/调平衡/加系统)若改变了确定性序列或结果,此测试立刻报红。 * 更新规则:仅当**有意**变更序列逻辑时,三枚 seed 指纹同版更新并注明原因。 */ // 0.1.18 时代绘卷基线:世纪弧 era 状态机(四态/调制)+ NPC 景气 prosperity // + 蝴蝶效应(互攻加权/打残广播/玩家行动写关系网)+ 十年一鉴后固化。 const GOLDEN: Record> = { 'bell-seed-1': { 560: 'd07ebe85', 1200: '32d9267f', 2160: '046967c9' }, 'bell-seed-2': { 560: '3fcec396', 1200: '3c40f605', 2160: 'b3ec6229' }, 'bell-seed-3': { 560: 'ecdc62da', 1200: '562bd778', 2160: '6ebb02a3' } } const TIERS = [ [560, '47 年(4 个十年)'], [1200, '100 年'], [2160, '180 年'] ] as const describe('金钟罩 · 长跑确定性指纹(三档:47/100/180 年)', () => { for (const [seed, tiers] of Object.entries(GOLDEN)) { for (const [months, label] of TIERS) { it(`${seed} ${label}指纹 === ${tiers[months]}`, () => { const w = run(seed, months) expect(stateFingerprint(w.state)).toBe(tiers[months]) }) } } it('同 seed 两次长跑指纹一致(无状态污染)', () => { const a = stateFingerprint(longRun('bell-seed-1').state) const b = stateFingerprint(longRun('bell-seed-1').state) expect(a).toBe(b) }) }) function run(seed: string, months: number): ReturnType { const w = World.create({ seed, surname: '钟', familyName: '钟家', motto: 'm', difficulty: 'normal' }) for (let i = 0; i < months; i++) { if (w.state.gameOver) break w.advanceMonth() } return w }