Pacman”s secret and his effective artificial intelligence: a success story

40 years of Pacman, it is said soon. That arcade was a revolution in the arcades of the eighties. Without having a promising reception in Japan, it got an explosive response in the US and later around the world. Today we ask ourselves what is the key to its success, and one of them is related to its magnificent AI.

Pacman is one of the most iconic and influential video games in history. Initially known as “Puck Man”, it was created by Toru Iwatani under the Namco brand in the year 1980. It was a time when Space Invaders and the shooters video games were the predominant genre. The arrival of the creation of Iwatani brought an absolute revolution to arcades around the world, not only because of its distinctive game play, but also because of its intuitiveness and because it attracted all kinds of audiences (without distinction).


On the occasion of its 40th anniversary, we wanted to pay tribute to this magnificent arcade, not reviewing its history, but discovering one of the keys to its success: its exemplary artificial intelligence. The routines followed by the four ghosts underpin the most important playable escape-chase mechanics in the Iwatani video game.


AI has been a reason for study and learning in students, such as at the University of Berkeley (California), where it has served as an instructional element for the development of applications: “After showing the case of Pacman, the students understood that they could apply their algorithms in other situations with bigger problems.” At IBM, AI experts even turned the concept around and created a program in which they taught Pacman how to avoid eating ghosts. The topic has also been disclosed by video game specialists like Mark Brown, who we use as one of the references in this article (along with others like Retro Game Mechanics). Definitely…How does this pioneering artificial intelligence work in your field? We explain below.


The secret is in the ghosts

Pacman”s concept is very simple: we have a character that must eat all the balls on the screen in a small maze. If it were all that, there would be no game. You need a challenge, and this is given by the enemies, who propose fun (and tension) to the approach. There are four ghosts that shine for a unique personality and routine, something quite new if we talk about it being a creation from 40 years ago:


  • Blinky (red ghost): we could define it as the most persistent ghost of all. He focuses his goal on Pacman and chases him to exhaustion.
  • Pinky (pink ghost): is the ghost that anticipates the player”s decisions, since he focuses his objective four squares ahead of Pacman”s gaze.
  • Clyde (orange ghost): this one stays away from Pacman always eight squares: let”s say that he is the vigilante, the one that lurks from a distance.
  • Inky(blue ghost): sets a target away from Pacman, so that he is the one in charge of surrounding the player, doing “pincer”.

The secret of this scheme is manifested in a key: that no ghost has the same programming routines. What”s more, they were designed to complement each other, to give the feeling that they act as a team. That is Pacman”s greatest achievement and effective AI. Thanks to this, each game is different, since it varies depending on the movements we make. Likewise, the difficulty increases with each minute of the game, through a series of design decisions that translate into:


  • The speed of Pacman increases gradually, so that it is more difficult to control him through the labyrinth.
  • The red ghost (Blinky) runs more as Pacman eats more pellets, while the rest chase after Pacman more often.
  • The power-up is less and less effective, since you have less time to eat the ghosts, and they return to the maze sooner after being eaten.

Another curious aspect of the video game, and that explains the proper functioning of its AI, is that it has some rules that are strictly observed to maintain a correct balance in the behavior of ghosts. These rules were very cleverly devised, so that the player feels that there really is an effective and to some extent natural pursuit. They are summarized in the following points:


  • Ghosts always chase Pacman along the shortest path, mathematically managing distances through existing squares.
  • If the distance is equal between two routes, the ghost”s priority is to go up first. If this address does not exist, it will go to the left. If not, down.
  • They can never go back, which is obvious if we consider the first rule, because they would be taking the longest path.
  • They return to their assigned corners when they enter these zones, giving the player a short breather before the chase resumes.
  • When they are scared, they move randomly in different directions, something that makes sense: they are afraid of being eaten!


We leave the most important aspect for last. Pacman”s magic and his AI reside in the three states that ghosts can experience: chase (chase), scatter (scatter) and frightened (scared). The transition between these three game modes during the game explains why the game is so mechanically varied, so that the player is not always escaping from the ghosts, but can face them and even take a breather to lower the tension. It is the great success of Namco”s work:

  • Chase State(Chase): The ghosts chase Pacman following the rules established in previous paragraphs. It is the moment of greatest tension, when the player must act with skill and intelligence.
  • Scatter state(dispersion): the ghosts, after the chase, separate and return to the corners assigned to them: it is as if they were still patrolling, a moment that the player can take advantage of to continue engulfing.
  • Frightened state(scared): after taking the power-up, we can eat the ghosts, going into an offensive state that can also serve as evasion if they come from the “chase” state. As you see, everything is complemented.

As you have seen, Pacman has many elements to be explained, and all of them together justify a powerful AI. Much more if we consider the fact that this video game has the incredible age of 40 years. And remember one thing: good artificial intelligence depends not only on existing technology, but on good game design. The case of Iwatani and Pacman should be taken into account in eternity, because it is a magnificent example of how much can be done with very little.

About The Author

VirallyMedia Editorial Staff

Our team of expert writers and researchers are dedicated to bringing you the latest trends, news, and best practices in various fields, including but not limited to business, technology, health, lifestyle, entertainment, and more. We strive to create informative and engaging content that is easy to understand and relevant to your needs.

Leave a Comment

Your email address will not be published. Required fields are marked *