A Brief Introduction to Pac-Man…
What is artificial intelligence (AI)? It is a technology that allows machines to mimic aspects of human intelligence, such as learning, understanding, solving problems, and making decisions.[1] Today, AI is everybody’s favorite buzzword, always AI this and AI that. It’s everywhere. But you may be surprised to learn that AI itself is not new, with modern systems just being more advanced and technically capable than those that came before. It’s not even new to the 21st century, having a long and fascinating history that in its modern form can be traced back to Alan Turing in the 1950s and his pioneering question, “Can machines think?”[2] However, the retro AI you are likely to be familiar with came into existence several decades later with the release of Pac-Man: a game that revolutionized the maze-chase genre through its groundbreaking AI. In July 1980, the Pac-Man game (originally called Puck Man) was released to the Japanese public, followed a few months later by an American release in October.[3] Forty-six years later, Pac-Man, Guinness World Records’ “Most Successful Coin-Operated Game,” still remains a fan favorite.[4] Pac-Man broke the mold of the traditional video game in many ways, steering away from the hype of the Space Invaders genre. Part of this was the groundbreaking implementation of AI through its iconic ghosts, whose dynamic decision-making algorithms marked a turning point for enemy actors in video games. Unlike many popular arcade games of the time, which utilized homogeneous, synchronized swarms of enemies, Pac-Man introduced four unique ghosts. Game creator Toru Iwatani later explained that he wanted each ghost to have “a specific character and its own particular movements.”[5] This design created a hunting team with unique specializations instead of having each ghost chase Pac-Man the same way.

Game Structure
To understand what made Pac-Man's ghosts revolutionary, you need to know how they actually think. For most of the game, the ghosts all follow the same fairly simple rules. The ghosts have three distinct game modes: scatter mode, chase mode, and frightened mode. They also have a separate eaten state. Frightened and eaten are much less common and player-dependent. Frightened mode occurs only when you eat one of the game’s Power Pellets, causing the ghosts to turn blue, move slowly, and reverse direction. If a ghost is eaten during this state, it transitions into the aptly named eaten mode and quickly returns to the ghost house at the center of the board. After the ghost is revived and leaves the ghost house, it resumes whatever game mode it was in before frightened mode began. Ghosts primarily alternate between the core chase mode and the brief scatter mode that follows. The chase mode is the main challenge of the game with each ghost chasing after Pac-Man. Again the shared logic of the ghosts here is simple: as each ghost approaches an intersection, it calculates the distance to its target and then chooses the direction that gets it closest to said target. Scatter mode gives players a short break from being chased and sends each ghost to a specific corner of the maze for a very short time interval before resuming chase mode.[6]

The Ghosts
What makes the game truly interesting is how each ghost determines their target tile when in chase mode. If you didn’t already know, each of the four Pac-Man ghosts has their own name and personality that directly corresponds to the deterministic AI algorithm they use to find their target. One important limitation that applies to all four ghosts is the way they respond to changes in their target positions. The ghosts cannot constantly change direction every time Pac-Man moves. The board would not even allow them to do so because its long corridors prevent them from turning whenever they want. Instead, as a ghost approaches an intersection, it uses its current target to choose its next turn one tile in advance. Once that decision is made, the ghost must stick with it until its next opportunity to choose a direction. Therefore, the ghosts are not always reacting to Pac-Man’s most current movement, giving the player a chance to change direction before they choose again.[7]

Blinky (Red)
The relentless shadow: that’s what Blinky, the red ghost, is known as. Those two words essentially sum up both his personality and the algorithm behind it. Blinky always targets Pac-Man’s current position. That’s it. No convoluted strategy or hesitation. He just constantly moves toward Pac-Man’s latest position. In Japan, he’s represented by the word oikake, meaning to run down or pursue. His AI literally does exactly that. He comes off as aggressive because his algorithm never gives him any other goal: get Pac-Man. You feel hunted by Blinky because his algorithm hunts you. Simple as that.[8]

Pinky (Pink)
Pinky, the pink one, is the most strategic of the ghosts. While Blinky chases Pac-Man’s current position, Pinky thinks ahead and cleverly targets four tiles ahead of Pac-Man in the direction he’s moving when she chooses her next turn. For example, if you were moving Pac-Man to the right, her target tile would be four tiles to the right of Pac-Man’s position at the time Pinky chooses her next turn. Moving left, four tiles to the left. Moving down, four tiles down. She's thinking ahead, seemingly anticipating your next move. This is what makes her feel like a different kind of threat. Blinky is chasing you. Pinky is trying to trap you. Her personality as the ambush predator comes directly from her algorithm. While she definitely feels smarter than Blinky, in reality she just targets a different tile. But that one difference in her algorithm creates a completely different hunting strategy.[9]

Inky (Cyan)
The cyan ghost, Inky, is the unpredictable ghost. As such, he has the most complex algorithm. He uses a two-vector calculation involving both Pac-Man’s and Blinky’s positions. The game calculates a tile two spaces ahead of Pac-Man, then uses Blinky’s position as a pivot point and doubles the vector. The resulting tile becomes Inky’s target. Since Inky’s target tile is dependent not just on Pac-Man, but on his fellow ghost Blinky as well, Inky’s behavior is constantly changing. Sometimes he’s aggressive like Blinky, sometimes he’s ambushing like Pinky, and sometimes he wanders off entirely. His chaotic, wild-card personality stems directly from his algorithm, making him unpredictable by design.[10]

Clyde (Orange)
Finally, the orange ghost, Clyde, is the coward of the group. His algorithm proves this: when he’s far from Pac-Man, more than eight tiles away, he confidently targets Pac-Man’s current position like Blinky. With his social distancing, he is a chaser. But the moment he gets close to Pac-Man, his true colors are revealed and he flees, with his target tile switching to his assigned corner of the gameboard. His scaredy-cat behavior is not a coincidence; it’s a intentional design choice reflected in his algorithm.[11]
How They Actually Calculate Distance
Here’s the thing: as each ghost approaches an intersection, it measures the distance between its target and each of the available next tiles, then picks the direction whose tile is closest. But the ghosts do not calculate the actual shortest path through the maze. While walls determine which directions they are allowed to choose, they are ignored in the distance calculation itself. The ghosts simply measure the straight-line distance between each available tile and their target. This means a direction can appear to bring a ghost closer even when the maze’s walls will eventually force it to take a longer route. The ghosts are not truly pathfinding. They are just moving toward a number.[12]
Why This Matters
The ghosts of Pac-Man aren’t intelligent. They’re not learning, they’re not adapting, and they’re not thinking in any real sense. They’re just following simple, deterministic rules. But what’s important is that the result feels intelligent. Before modern AI, before deep learning and large language models, Pac-Man proved something fundamental: intelligence can be faked. You don’t need a computer to think like a human; you just need the human to think that it’s true. Simple rules applied consistently, as exemplified by the ghosts, are enough. When combined, four basic algorithms create a user experience that’s challenging, engaging, and still fun after forty-six years. And that is the legacy of Pac-Man’s AI: innovation without technological complexity.

Bonus: The Famous Pinky Bug
Here’s where it gets fun. Pinky’s algorithm is supposed to place her target four tiles ahead of Pac-Man, but a small error in the game’s code changes what happens when he faces upward. Pac-Man’s direction is stored as a pair of values representing vertical and horizontal movement. To calculate a position four tiles ahead, the code doubles those values twice. This works correctly when Pac-Man is moving left, right, or down. However, when he moves up, the negative value used to represent upward movement causes an overflow into the horizontal part of the calculation. As a result, Pinky’s target is placed four tiles up and four tiles to the left instead of directly ahead. Note that this bug does not make her unpredictable; rather, it makes her predictably wrong in one very specific situation. The same error also affects the first step of Inky’s target calculation, shifting his intermediate tile two spaces up and two spaces left when Pac-Man faces upward.[13] The bug remains in versions that faithfully reproduce the original arcade code, although some later ports have corrected it.[14]