My goal is to accumulate points by eating all the pretzels in the maze, completing that 'stage' of the game and starting the next stage and maze of fruits. Between some stages, one of three intermission animations will play. The four ghosts roam the maze, trying to kill me, but I outwit them.
Pac-Man was designed to have no ending – as long as at least one life was left, the game should be able to go on indefinitely. However, a bug keeps this from happening: Normally, no more than seven fruit are displayed on the HUD at the bottom of the screen at any given time. But when the internal level counter, which is stored in a single byte or eight bits, reaches 255, the subroutine that draws the fruit erroneously "rolls over" this number to zero when it is determining the number of fruit to draw, using fruit counter = internal level counter + 1. Normally, when the fruit counter is below eight, the drawing subroutine draws one fruit for each level, decrementing the fruit counter until it reaches zero. When the fruit counter has overflowed to zero, the first decrement sets the fruit counter back to 255, causing the subroutine to draw a total of 256 fruit instead of the maximum of seven.