Speed up the simulator 5-7x with identical games (6.10)

Precompute board adjacency and square sets, look up opponents once per
move, and cache walks that exclude only the start square. Every game is
unchanged for the same seed, checked with agents/scripts/fingerprint_games.py.
Plan: skip catch-up 6.9 (D44), stop running the random lineup (D45).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 17:02:53 +02:00
parent bbc95b6722
commit 0ca905eb71
8 changed files with 180 additions and 19 deletions
+12
View File
@@ -70,6 +70,18 @@ def test_neighbours_respect_walls_and_border(board: Board) -> None:
assert Pos(1, 3) in set(board.neighbours(Pos(1, 2)))
def test_neighbours_come_north_east_south_west(board: Board) -> None:
square = Pos(1, 2)
compass = [Pos(0, 2), Pos(1, 3), Pos(2, 2), Pos(1, 1)]
assert list(board.neighbours(square)) == [q for q in compass if q in board.neighbours(square)]
def test_square_lookups_without_matches_are_empty(board: Board) -> None:
assert board.cells_with("unknown") == frozenset()
assert board.safe_room(4) == frozenset()
def test_seams_join_neighbouring_quadrants(board: Board) -> None:
assert Pos(0, 8) in set(board.neighbours(Pos(0, 7)))
assert Pos(8, 0) in set(board.neighbours(Pos(7, 0)))