Search the playthrough's paths once per question [no-card]
Checks / web (push) Successful in 1m47s
Private ROM checks / private-rom (push) Successful in 18m6s

findPath now takes the visible objects and warps once per search, and
training and map crossings measure every candidate tile in one search
instead of one search per tile. The routes chosen are the same; the
45-stage playthrough runs in seconds again, which the slower CI host
needs (the Whitney stage hit its time limit there).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kawaandClaude Opus 5.5 committed 2026-10-13 15:49:59 +02:00
1 parent 4aae3887e7
commit aff8391e55
2 files changed
+106 -67

No files matched your search

+9 -12
View File
@@ -8,7 +8,7 @@ import type { Direction } from "../src/game/world/types";
import { C } from "../src/game/battle/constants";
import { applyTypeMatchups } from "../src/game/battle/battle";
import { BattleData } from "../src/game/battle/data";
import { afterRestore, findPath, isWhirlpool, landing } from "./world-driver";
import { afterRestore, findPath, isWhirlpool, landing, pathLengths } from "./world-driver";
const STEP: Record<Direction, [number, number]> = {
up: [0, -1],
@@ -301,6 +301,7 @@ export class Playthrough {
const world = this.world,
map = world.mapId;
const [dx, dy] = STEP[direction];
const lengths = pathLengths(world, { water, ledges: this.ledges });
const edge = Array.from(
{ length: dx ? world.map.height : world.map.width },
(_, i) =>
@@ -310,11 +311,8 @@ export class Playthrough {
).flatMap(([x, y]) => {
// A warp on the edge (a gate's doorway) is not the connection.
if (world.map.warps.some((warp) => warp.x === x && warp.y === y)) return [];
try {
return [{ x, y, length: findPath(world, x, y, { water, ledges: this.ledges }).length }];
} catch {
return [];
}
const length = lengths.get(`${x},${y}`);
return length === undefined ? [] : [{ x, y, length }];
});
edge.sort((a, b) => a.length - b.length);
for (const { x, y } of edge) {
@@ -416,14 +414,13 @@ export class Playthrough {
expect(this.world.mapId).toBe(map);
}
const pairs: { x: number; y: number; length: number }[] = [];
const lengths = pathLengths(world);
for (let y = 0; y < world.map.height; y++)
for (let x = 0; x < world.map.width; x++)
if (isGrass(x, y) && isGrass(x + 1, y))
try {
pairs.push({ x, y, length: findPath(world, x, y).length });
} catch {
/* unreachable */
}
if (isGrass(x, y) && isGrass(x + 1, y)) {
const length = lengths.get(`${x},${y}`);
if (length !== undefined) pairs.push({ x, y, length });
}
pairs.sort((a, b) => a.length - b.length);
const { x, y } = pairs[0];
this.walk(x, y);