In case you are not familiar with the arcade game Pac-Man: the main objective of the game is to eat all pellets present in the maze and to avoid the ghosts (as demonstrated in the video above). In this version of the Pac-Man game, we start with four ghosts in the first level. After every two levels, an additional ghost is added to the game (this is similar to a feature of the game Crunchy Munch, a cousin game of Pac-Man). The maximum number of ghosts is 8. Pac-Man has three lives per game. The maze that the ghosts and Pac-Man move around in is randomly-generated each time the page loads. So, for every new game/refresh, the maze changes. As a note, I've not added audio/sound effects to this game as I personally do not like arcade game sound effects. This makes it flexible for you to add your own custom sound effects to the game. :)
Play the game here!
Credit:
I modified Conor Bailey's maze generation file to generate the maze for this game. I also modified William Fiset's breadth-first search algorithm from his YouTube tutorial.
If you're interested in looking at the source code for this project (it also has links to the code provided by the credited sources above) , you can follow this link to its GitHub repository: Pac-Man Repository