1 Commits
Author SHA1 Message Date
luriasb 66100a7b74 release ghosts from the pen via door target and staged exit
SPEC 01's four archetypes never left the ghost pen. With Pac-Man starting
below the pen, greedy Manhattan pursuit scores `up` as the worst option
from every cell inside, so the door is never chosen and all four ghosts
walk a closed loop forever. The bug predates SPEC 01: the original
`hunter` ghost was trapped too, and only the removed `random` ghost
escaped by luck, masking it.

Fixes it by aiming ghosts at the door while they are inside a PEN box,
then gating the release one ghost per GHOST_RELEASE_FRAMES.

The box deliberately includes row 12, the two door cells. Stopping at
row 13 would hand control back to the archetype while the ghost is
still in the doorway, and its target below would pull it back inside.

Measured on the first life with Pac-Man idle: the four ghosts clear PEN
at frames 51, 90, 160 and 240, all before the 300-frame criterion.
The release replays after a death because resetPositions zeroes
game.frame.

Implements SPEC 02 and closes the unmet acceptance criterion it leaves
in SPEC 01. The game stays deterministic; no randomness is introduced.
2026-10-18 01:12:38 -06:00