The Pac-Man Dossier

Nerd heaven.

In chase mode,
Pinky behaves as he does because he does not target Pac-Man’s tile
directly. Instead, he selects an offset four tiles away from
Pac-Man in the direction Pac-Man is currently moving (with one
exception). The pictures below illustrate the four possible
offsets Pinky will use to determine his target tile based on
Pac-Man’s orientation:

If Pac-Man is
moving left, Pinky’s target tile will be four game tiles to the
left of Pac-Man’s current tile. If Pac-Man is moving right,
Pinky’s tile will be four tiles to the right. If Pac-Man is moving
down, Pinky’s target is four tiles below. Finally, if Pac-Man is
moving up, Pinky’s target tile will be four tiles up and four tiles to the left. This
interesting outcome is due to a subtle error in the logic code
that calculates Pinky’s offset from Pac-Man. This piece of code
works properly for the other three cases but, when Pac-Man is
moving upwards, triggers an overflow bug that mistakenly includes
a left offset equal in distance to the expected up offset (we will
see this same issue in Inky’s logic later). Don Hodges’ website
has an excellent article giving a thorough, code-level analysis of
this bug, including the source code and a proposed fix–click
to go there now.