
Electronic Games • Chapter 22 431
Programming the Pinball Machine
The Pinball is not very complicated to program.When the game starts, reset the
score to zero and the ball count to the initial number (e.g., five balls).Then start a
loop that monitors the following events:
■
If the ball passes over the light sensor, it decrements the count by one
unit.When it goes ...