feedback1d WO: the preference route is 0.1.0's again; equal floor keeps the official route
Review follow-up to the D5 fix. Two changes in grid.js _buildField: - The road-over-floor preference smoothing is 0.1.0's again: its line of sight may cover non-blockable tiles (Bresenham footprint, diagonal-step corners included) only on the tile's own raw chain, and the jump stops at the first ancestor it cannot see so. Exact crossings (a corner touch is not a crossing) are used only to choose between the official and the preference pointer. The previous version let the preference brush the corner of off-chain floor, so on 战场#02's Final Assault the right-half exit route (2,10) -> (3,11) slipped past an operator on (2,11) while the left half was still blocked on (2,9). Both halves now mirror each other again ((2,10) -> (2,11) -> (4,11)). - On an equal floor count the official pointer stays; the preference pointer wins only when it merely skips a collinear official waypoint (same walk). The old "farther waypoint" tie-break could bend an official route without saving any floor, e.g. a crate on (10,6) of 战场#04 brought back the L via (9,8) for the lower gate. Still 140 of 154 stage routes official; data/stages.json groundPaths regenerated (战场#02 boss right exit back to 0.1.0's, device-less helper paths of #03 / #04 / #06 follow the same rule). New tests: 战场#02 boss exits mirror and are blocked beside the exit; a single crate on any tile of an active stage never leaves a gate route non-official without crossing strictly less floor. The cross-check reference port follows both rules.
This commit is contained in:
1 parent
d8c62a96b5
commit
7a3918eab9
8 files changed
+147
-74
No files matched your search
@@ -424,7 +424,7 @@ test('random layouts: official lengths, fewest non-blockable tiles among equal-l
|
||||
// routes: strictly closer each hop; every segment is official line of sight (walkable, crate-free Bresenham
|
||||
// footprint); `cost` = the non-blockable tiles the route crosses; never more than the pure official route, nor than
|
||||
// the fewest-floor chain (pen); a pointer other than the official one crosses strictly less floor, or as little
|
||||
// with a farther waypoint
|
||||
// while it only skips the official waypoint (which lies on the straight line to it and leads there)
|
||||
assert.deepEqual([...f.official], [...fp.next], `${what}: the official pointers`);
|
||||
const nbSeg = (x, y) => segmentTiles([(x / COLS) | 0, x % COLS], [(y / COLS) | 0, y % COLS]).slice(1).filter(([r, c]) => g.unblockable[r * COLS + c]).length;
|
||||
const offNb = new Int32Array(N);
|
||||
@@ -445,7 +445,10 @@ test('random layouts: official lengths, fewest non-blockable tiles among equal-l
|
||||
assert.ok(f.cost[k] <= f.pen[k] - g.unblockable[k] + g.unblockable[dest], `${what}: (${a}) more floor than its fewest-floor chain`);
|
||||
if (y !== o) {
|
||||
const co = nbSeg(k, o) + f.cost[o];
|
||||
assert.ok(f.cost[k] < co || (f.cost[k] === co && f.dist[y] < f.dist[o]), `${what}: (${a}) leaves the official pointer without less floor`);
|
||||
const oo = [(o / COLS) | 0, o % COLS];
|
||||
const skips = f.next[o] === y && (oo[0] - a[0]) * (b[1] - a[1]) === (oo[1] - a[1]) * (b[0] - a[0])
|
||||
&& segmentTiles(a, b).some(([r, c]) => r === oo[0] && c === oo[1]);
|
||||
assert.ok(f.cost[k] < co || (f.cost[k] === co && skips), `${what}: (${a}) leaves the official pointer without less floor`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user