Understanding Pac-Man Ghost Behavior
Inky actually uses both Pac-Man’s position/facing as well as Blinky’s (the red ghost’s) position in his calculation. To locate Inky’s target, we first start by selecting the position two tiles in front of Pac-Man in his current direction of travel, similar to Pinky’s targeting method. From there, imagine drawing a vector from Blinky’s position to this tile, and then doubling the length of the vector. The tile that this new, extended vector ends on will be Inky’s actual target.
As a result, Inky’s target can vary wildly when Blinky is not near Pac-Man, but if Blinky is in close pursuit, Inky generally will be as well. Note that Inky’s “two tiles in front of Pac-Man” calculation suffers from exactly the same overflow error as Pinky’s four-tile equivalent, so if Pac-Man is heading upwards, the endpoint of the initial vector from Blinky (before doubling) will actually be two tiles up and two tiles left of Pac-Man.