- WorldSim(engine/sim/WorldSim.ts + worldsim-data.ts): A 资源循环市场(库存池/再平衡/价格弹性——Market 行情联动 sim.mult) B NPC 聚合演化(宗主换代/境界成长/势力=境界+财力+兵员;换代计数) C 秘境灵气(探索消耗/恢复)+ 灵气潮汐(6年周期×修炼倍率) D 灾年签(旱涝蝗疫兽寒,联动市场池) E 天下快讯(节流 24 月滚动 120 条,世界动态 feed) - 相位:新增 worldsim(diplomacy 后 epilogue 前);capabilities 加「天下演序」卡可停用 - 时钟合一:World.clock = Kernel.clock(单一时钟驱动,消除双时钟漂移) - 发现并修复:worldsim 注册被文件搬迁覆盖丢失(修改纪律验证中招——已补回); WorldSim 内 Math.random 根除(改 w.rng) - fingerprint 纳入 worldSim 概要(市场/灵脉/潮汐/换代/快讯数) - 金钟罩三档重固化(0.1.14 正式基线,受控变更) - 验证:35 套件/967 测试全绿;typecheck 0 error
48 lines
1.8 KiB
TypeScript
48 lines
1.8 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.14 正式基线:worldsim 世界自进化(确定性重写后)三档固化。
|
|
const GOLDEN: Record<string, Record<number, string>> = {
|
|
'bell-seed-1': { 560: '5dac4915', 1200: 'e13fc9be', 2160: '7a0317c2' },
|
|
'bell-seed-2': { 560: '53005425', 1200: 'ad956d85', 2160: '3b31fc8b' },
|
|
'bell-seed-3': { 560: 'b7c3ff06', 1200: '4eb51c1f', 2160: '64433376' }
|
|
}
|
|
|
|
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
|
|
}
|