Pacman C++ / AI

The Pacman game completely self-programmed in C++ using an AI search algorithm.

In the AI programming course from module 6, I learned a new programming language; C++. I used C++ to study different kinds of AI search algorithms; Depth-First search, Bread-First search, Greedy search, and A* search.

The end assignment of the course was to make an interactive installation that uses an algorithm of AI from above also the interaction should use some piece of hardware like Arduino input.

Together with a classmate, we programmed the classic game Pacman in C++. I used the A* search as the AI algorithm for the ghosts that are chasing Pacman. The ghosts also have some heuristics because otherwise, it’s impossible to escape from the. The heuristics function has the following rules:

  • Search range for pacman= MANHATTEN DIST < 10
  • Only chase pacman if pacman is not respawning
  • Loose pacman after 15 seconds, and chase a random block till it is reached
  • If pacman is not chased than chase random block
  • If random block is reached -> assign new random block

Game consists of a start screen and playground with characters: 1 pacman, 4 monsters


As hardware component, we made our own controller.

Made of:

  • Arduino nano
  • Joystick
  • Push button
  • Wooden laser cut housing
  • 3d printed shell for the joystick
  • Vibration motor for haptic feedback


Posted in Portfolio.

Leave a Reply

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