In this guide, you will learn how to write a cute and fun little game for the Circuit Playground Express board, using the CircuitPython language. The game is a clone of Simon, a once very popular game of memory in which you have to remember a sequence of colors and sounds that gets progressively longer. This game was an instant hit when it was released in 1978 and became a pop culture symbol of the 1970s and 1980s.
In case you have never heard of Simon before, below you can see the original game console in all its splendor:
How do you play this game? Simon generates a random sequence of light and sound signals that you have to repeat by pressing the buttons in the same order. The first sequence has just one signal so it is very easy, but the game gets progressively harder because each time you complete the sequence, one more signal is added at the end. Take a look at this video in which I play the game as implemented on this guide:
My version of this game for the Circuit Playground Express uses several of the features of this board:
- The ten NeoPixel RGB LEDs are split in groups to represent the four colored areas
- The speaker plays tones that approximate those of the original game console
- The capacitive touch inputs are used for the player to enter the sequence
To write this game, I used a software technique called bottom-up development. The basic idea is to take a complex project and break it up into smaller and simpler tasks. You begin by implementing the smaller tasks and then work your way up to the bigger ones, which are now less complex because they can rely on the lower level tasks that are already implemented. This way of tackling a software task is good for many types of projects, but is particularly well suited for games. I hope once you learn it you will be able to apply to your own projects!
This is an easy, no solder project. All you need is an Adafruit Circuit Playground Express board and a known good USB A to microB cable containing both power and data wires. Do not use the stubby USB cables that come with cell phone charging batteries, most do not have the data wires!