feat: expand campaign and refine puzzle visuals and controls

This commit is contained in:
cabinw
2026-09-09 11:02:45 +08:00
parent 9f8990b579
commit 70b021d4cc
66 changed files with 41108 additions and 10553 deletions
+21
View File
@@ -0,0 +1,21 @@
import { hexagon, solve, trace } from '../../src/core.js';
// A compact, deterministic visual fixture. Each inserted piece can escape before
// all earlier pieces, so reverse insertion always yields a complete solution.
export function makeLabLevel() {
const level = { version: 1, name: '薄片六边形实验', cells: hexagon(2), tiles: [], moveLimit: 18, rotationEnabled: true };
const candidates = [
[0,0,0],[0,-1,0],[0,1,3],[-1,0,5],[1,0,2],[1,-1,0],
[0,-2,0],[0,2,3],[-2,1,5],[2,-1,1],[-1,-1,4],[1,-2,0],
[-1,2,3],[1,1,2],[-2,2,4],[2,-2,5],[-2,0,5],[2,0,1]
];
for (const [q,r,preferred] of candidates) {
for (let offset = 0; offset < 6; offset++) {
const dir = (preferred + offset) % 6;
const tile = { id: `lab-${level.tiles.length}`, q, r, dir, color: dir };
if (trace(level, tile, [...level.tiles,tile]).status === 'exit') { level.tiles.push(tile); break; }
}
}
level.moveLimit = level.tiles.length;
if (!solve(level).solvable) throw new Error('Lab fixture must be solvable');
return level;
}