The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1

150 THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE


5 Figure 6-8: Once the winner is decided, the program exits

Congratulations: you’ve made your own physical game!

CHALLENGE: IMPROVE THE GAME
Can you add a loop, so the game runs continuously?
Remember to remove the _exit(0) instruction first! Can
you add a score counter, so you can see who is winning
over multiple rounds? What about a timer, so you can see
just how long it took you to react to the light going off?
Free download pdf