57 lines
2.4 KiB
TypeScript
57 lines
2.4 KiB
TypeScript
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.40 天命·裂痕基线:天命系统+NPC宗主更替四模式+NPC势力分裂+灰烬重生新贵补位+建筑专精——
|
|
// 全线受控变更重算(NPC演化逻辑增强+天命epilogue注册改变了时序/确定性序列)。
|
|
const GOLDEN: Record<string, Record<number, string>> = {
|
|
'bell-seed-1': { 560: 'b050ad28', 1200: '379ad2e1', 2160: '2fada283' },
|
|
'bell-seed-2': { 560: 'e3b4d40b', 1200: '5fb3aa1f', 2160: '50ad6832' },
|
|
'bell-seed-3': { 560: '0b56c19b', 1200: '4737eedf', 2160: 'f597c050' }
|
|
}
|
|
|
|
/** 第二金钟罩:自动 resolve 长跑("现实"世界——每 tick 处理待决事件;
|
|
* 锁事件闸/事件流全程,防"冻结世界"指纹漏锁)。 */
|
|
const GOLDEN_RESOLVED: Record<string, Record<number, string>> = {
|
|
'bell-seed-1': { 560: '88f28074', 1200: 'd6b9cc85', 2160: 'c5b9b102' },
|
|
'bell-seed-2': { 560: '5ca6b6a9', 1200: '6a66a750', 2160: 'c8e8e982' },
|
|
'bell-seed-3': { 560: 'fb5bc0e8', 1200: '3e09f864', 2160: 'fae786ae' }
|
|
}
|
|
|
|
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<typeof longRun> {
|
|
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
|
|
}
|