To prevent the four enemies from chasing the player in a monotonous and impossible single-file line, designer Toru Iwatani devised a unique algorithmic behavior for each ghost in the 1980 classic Pac-Man.

When Namco began developing the project under the name Puck-Man in early 1979, Iwatani aimed to break away from the trend of space shooters spurred by the Space Invaders craze. His goal was to create an approachable title appealing to both men and women, focused on eating inside a maze without resorting to direct violence. However, after introducing four pursuing monsters, the team quickly faced a severe design hurdle: if every enemy shared the same tracking logic and simply ran straight after the yellow character, the chase became tedious and hopelessly trapped the player with no tactical means of escape.

The individual formula behind each pursuer

The technical solution was to program four distinct mathematical personalities structured around a grid of tiles and shifting targets, detailed in the historical analysis known as The Pac-Man Dossier. The entire maze is divided into discrete eight-pixel tiles, and each ghost continuously calculates a specific target tile depending on its current state, alternating at set intervals between chase and scatter modes.

The Four Ghost Personalities in Pac-Man: The AI Trick That Saved the Arcade Classic

Blinky, the red ghost (originally named Akabei in Japan), serves as the quintessential direct pursuer. His target tile matches the exact coordinate occupied by the player at all times, turning him into a relentless shadow right on the player's tail. Meanwhile, the pink ghost, Pinky, functions as the ambusher: her target tile is placed four tiles ahead of the direction Pac-Man is facing, anticipating movement to cut off escape routes at upcoming intersections.

From coordinated geometry to programmed cowardice

The third enemy, Inky (the cyan ghost), features the most complex and erratic logic in the arcade machine. To calculate his target tile, the game constructs a vector starting from Blinky's current position to two tiles ahead of the player, doubling that distance. Because this calculation relies directly on where Blinky stands, Inky's maneuvers become nearly unpredictable, often creating accidental pincer attacks or erratic sweeps that derail players relying purely on memorized routines.

The Four Ghost Personalities in Pac-Man: The AI Trick That Saved the Arcade Classic

Finally, the orange ghost, Clyde (Guzuta in Japan), exhibits a blend of feigned indifference and calculated cowardice. Clyde constantly measures his Euclidean distance in tiles relative to the hero: if he is more than eight tiles away from Pac-Man, his target tile points straight at the player just like Blinky. However, the moment he gets closer than eight tiles, his algorithm abandons the chase and steers him toward his scatter home corner in the bottom left of the maze. This sudden retreat gives the illusion of a ghost wandering off or losing interest just before delivering a fatal blow.

Thanks to these four rudimentary yet complementary pathfinding routines, Toru Iwatani's creation established an organic sense of tension that eliminated mechanical monotony, turning simple pastel sprites into timeless rivals in gaming history.