On the Subject of Frightened Ghost Movement
“Why are you blue?”
This module attempts to simulate the behavior of ghosts in PAC-MAN when they are in a frightened state. In gameplay, this occurs when Pac-Man eats a power pellet. The four blue buttons display each ghost’s coordinate—always at an intersection—on the map and the direction it was traveling when it entered the intersection.
The buttons can be pressed to change the directions displayed. To solve the module, point the arrows in the direction each ghost will go next and then press the yellow button in the center of the module. Hold down the yellow button to reset the displayed arrows.
Generating the RNG Indices
- To determine the starting directions, four RNG indices must be calculated, which respresent each ghost in reading order.
- The first RNG index is equal to the bomb's serial number digits concatenated modulo 8192.
- Generate three more indices by multiplying the previous index by 5 and adding 1, modulo 8192.
Ri = (5 × Ri-1 + 1) mod 8192
Obtaining the Starting Directions
- Once the RNG indices are obtained, take each of them modulo 400 and index them into the ROM Table on the following page.
- The numbers obtained from the ROM Table correspond to a direction as depicted to the right.
Obtaining the Final Directions
- Locate each ghost on the map found on page 3.
- If the ghost can move in the direction obtained from the ROM Table, it will move in that direction. Otherwise, rotate it clockwise until the ghost can move in that direction.
- A ghost cannot move in a direction if there is a wall in that direction.
- A ghost also cannot move in the direction opposite their current direction (which is displayed on each button).