feat(levels): gate on crossing points, and lay the campaign out as segments
trackShape moves the two drawing measurements into src so the sweep, the pool build, the selector and the gallery share one definition. They are one property seen twice: a chord joining opposite ports is a straight line, and two of those in a cell always cross, which is why the filler that paired leftovers straight across produced a board that is both all-straight and all-crossings. Crossings per cell is now a gate at 1.0. Bending the leftover ports alone takes the median from 2.36 to 0.93, so the gate costs a third of the candidates rather than most of them, and it is the difference the boards were described by. Selection gains --plan, an ordered list of segments each naming how many levels it wants and of what kind. Depth quotas cannot express the shape this campaign needs, because the two good things pull against each other: a crowded board clears beautifully and caps at three turns, while a deep lock needs room and so stays sparse — at five turns and eight pieces per orientation, 16 of 18 candidates fail the release gate. Sorting by depth would file every crowded level first and every deep one last; segments alternate them deliberately, and a plan is left in the order it was written rather than re-sorted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,12 +23,13 @@
|
||||
// turning is the game's signature and should not be rationed.
|
||||
import { readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { deadTurnAudit, deepLevelKey } from '../src/deep-lock.js';
|
||||
import { deadTurnAudit, deepLevelKey, trackShape } from '../src/deep-lock.js';
|
||||
|
||||
const args = Object.fromEntries(process.argv.slice(2).map(a => { const [k, ...v] = a.replace(/^--/, '').split('='); return [k, v.length ? v.join('=') : true]; }));
|
||||
const OUT = resolve(args.out ?? 'bench/pool.json');
|
||||
const MAX_TIGHT = Number(args.maxTightShare ?? 0.005);
|
||||
const MAX_DEAD = Number(args.maxDeadTurns ?? 1);
|
||||
const MAX_CROSS = Number(args.maxCrossPerCell ?? 1.0);
|
||||
|
||||
// Shards from a sweep, or level files listed directly.
|
||||
const sources = String(args.in ?? 'bench/shards').split(',').map(s => resolve(s.trim()));
|
||||
@@ -60,14 +61,16 @@ for (const level of unique) {
|
||||
}
|
||||
|
||||
const open = unique.filter(l => (l.prototype.audit.endgameTightShare ?? 1) <= MAX_TIGHT);
|
||||
const kept = open.filter(l => (l.prototype.audit.maxDeadTurns ?? Infinity) <= MAX_DEAD);
|
||||
const quiet = open.filter(l => (l.prototype.audit.maxDeadTurns ?? Infinity) <= MAX_DEAD);
|
||||
const kept = quiet.filter(l => (l.prototype.shape ?? trackShape(l)).crossPerCell <= MAX_CROSS);
|
||||
|
||||
const tally = (rows, f) => rows.reduce((m, l) => { const k = f(l); m[k] = (m[k] || 0) + 1; return m; }, {});
|
||||
const rot = l => l.prototype?.stats?.rotations ?? '?';
|
||||
const fam = l => l.prototype?.family ?? (String(l.id).startsWith('trail-') ? 'v05' : '?');
|
||||
console.log(`${files.length} 个来源合计 ${all.length} → 去重 ${unique.length}${audited ? `(其中 ${audited} 关现场补算了 audit)` : ''}`);
|
||||
console.log(` 终局紧局 ≤${(MAX_TIGHT*100).toFixed(1)}% → ${open.length}(${Math.round(100 * open.length / unique.length)}%)`);
|
||||
console.log(` 连续空转 ≤${MAX_DEAD} → ${kept.length}(${Math.round(100 * kept.length / unique.length)}%)`);
|
||||
console.log(` 连续空转 ≤${MAX_DEAD} → ${quiet.length}(${Math.round(100 * quiet.length / unique.length)}%)`);
|
||||
console.log(` 交叉/格 ≤${MAX_CROSS} → ${kept.length}(${Math.round(100 * kept.length / unique.length)}%)`);
|
||||
console.log(`旋转深度 ${JSON.stringify(tally(kept, rot))}`);
|
||||
console.log(`家族 ${JSON.stringify(tally(kept, fam))}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user