release ghosts from the pen via door target and staged exit #2

Merged
devlez-gitea merged 1 commits from spec-02-ghost-pen-release into main 2026-10-18 07:14:30 +00:00
Owner

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.

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.
devlez-gitea added 1 commit 2026-10-18 07:14:24 +00:00
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.
devlez-gitea merged commit 75814528f0 into main 2026-10-18 07:14:30 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devlez-gitea/open-pacman#2