结构(旧 game/core+engine → 新 engine/ 域): - engine/kernel/ 时钟/随机/插件协议/fxqueue/timesense/format/urgency/guide/names(原 core) - engine/narrative/ legacy/报告/列传/谱系/年轴(原 core 叙事族) - engine/runtime/ World/creation/pcgen/ApiFacade/capabilities/pluginManager/boot/clocks + Systems/*(12 系统) - engine/sim/ Market(未来 WorldSim 同行) - 旧 game/core、engine/systems、engine/world.ts 等路径全部废弃(无 re-export 兼容层) 验证:35 套件/967 测试全绿(金钟罩三档零漂移=纯搬迁无行为变化) typecheck 0 error
49 lines
1.9 KiB
TypeScript
49 lines
1.9 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.10 基线:长线数值重建(修炼提速/寿元放宽/渡劫修复)后三档固化为 47/100/180 年。
|
||
// 0.1.8 时修复批次后为 9af71ecb/63cede89/ebfec4a4;0.1.10 有意变更数值后按三档重算。
|
||
const GOLDEN: Record<string, Record<number, string>> = {
|
||
'bell-seed-1': { 560: 'ffdd3fb1', 1200: '76787bd9', 2160: 'e3f0a1cd' },
|
||
'bell-seed-2': { 560: '1dd432bb', 1200: '8ab8db6d', 2160: '2340e385' },
|
||
'bell-seed-3': { 560: '195b8aaa', 1200: 'a19e1a90', 2160: '2d767a64' }
|
||
}
|
||
|
||
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
|
||
}
|