- 玩法一 数字一笔:规则库、求解器、26 关、竖屏触摸 Web 原型、测试 - 玩法二 连连气球:连消畅玩版核心、Web 原型、Cocos 球槽组件与导出脚本 - 玩法三 六边一笔:规则库、求解器、10 关 + 转墙实验包、Web 原型、测试 - 产品文档、UI 设计规范、各玩法 GDD / HANDOFF - 文档移除全部外部参考作引用;删除玩法二 v0 旧稿
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { readFileSync, writeFileSync } from 'node:fs';
|
|
import { Game } from '../src/game';
|
|
import { solve } from '../src/solver';
|
|
import type { Level } from '../src/types';
|
|
|
|
const file = new URL('../levels/campaign.json', import.meta.url);
|
|
const pack = JSON.parse(readFileSync(file, 'utf8')) as { levels: Level[] };
|
|
for (const level of pack.levels) {
|
|
if (level.solution?.length) continue;
|
|
let found = false;
|
|
for (let trial = 0; trial < 24; trial++) {
|
|
const start = Date.now();
|
|
const game = new Game(level);
|
|
const solution = solve(game, level.id < 7 ? 12 : 18);
|
|
console.log(`L${level.id} seed=${level.seed} ${solution ? `WIN ${solution.path.length} moves / ${solution.visited} states` : 'no proof'} ${Date.now() - start}ms`);
|
|
if (solution) {
|
|
level.solution = solution.path;
|
|
level.par = solution.path.length;
|
|
writeFileSync(file, JSON.stringify(pack, null, 2) + '\n');
|
|
found = true; break;
|
|
}
|
|
level.seed += 137;
|
|
}
|
|
if (!found) throw new Error(`Unable to find L${level.id}`);
|
|
}
|