Simon Game
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Simon Game

by bbunderson on Mon Jul 18, 2016 11:49 pm

I thought I would try out the new CircuitPlayground developer board by writing a simple memory game similar to the old Simon game. It was fun so I though I would post it! I've attached the code.

(8.64 KiB) Downloaded 67 times

Posts: 6
Joined: Mon Dec 28, 2015 7:21 pm

Re: Simon Game

by adafruit_support_mike on Tue Jul 19, 2016 1:54 am

Nicely done! Thanks for posting it!

Posts: 45841
Joined: Thu Feb 11, 2010 2:51 pm

Re: Simon Game

by pickledkitty on Fri Aug 05, 2016 12:14 pm

That was awesome! Thanks for posting the code, everything worked perfect after I copied and pasted the TXT file into an Arduino sketch.

Posts: 4
Joined: Fri Jan 04, 2013 10:56 pm

Re: Simon Game

by bbunderson on Fri Aug 05, 2016 12:27 pm

You're welcome. I'm glad you liked it. Perhaps you can post the updates if you decide to add all the levels to the game? :)

Posts: 6
Joined: Mon Dec 28, 2015 7:21 pm

Re: Simon Game

by hwiguna on Sun Aug 07, 2016 11:02 pm

bbunderson, that's an awesome implementation of Simon Says! Well done! Thanks for sharing the code! I've already learned how to debounce the capacitive sensor by reading your code. I'll continue to study your code and learn more. Thanks again!

Posts: 27
Joined: Wed Nov 16, 2011 10:33 am

Re: Simon Game

by sa0987 on Sun Aug 14, 2016 12:09 pm

Wow, this is impressive.

I had a mastermind game with 5050 strip before. I will try to see if I can translate it to this. Using the touch, I can change the color scheme being guessed. and the user can post a response. or using the buttons for black and white. Deboucing seems to be a big issue. I have had limited success with it before. I will review you code (as mentioned elsewhere) to work thru it.

did you have code to start with? this seems like a lot of code to write from scratch.

I guess the next thing we need is an enclosure to hold this in place

this is a fantastic board and fantastic code. Congrats.

Posts: 8
Joined: Thu May 21, 2015 2:27 pm

Re: Simon Game

by bbunderson on Sun Aug 14, 2016 6:27 pm


Thank you! Your Mastermind game sounds awesome!

Like most code, the Simon game was a learning process. I started by tracking down the rules of the original game. Then I wrote down the rules in a file that I kept alongside my project. I also found some pictures of the original game and some notes about what tones were used. I wrote that down too. Finally I built a list of things that I needed to learn, such as how to debounce a button, and found some example code or just tried things until I could make the board do everything that I wanted it to do. I moved tasks off the list when I got them working and added tasks to the list as I got new ideas. Once the game was somewhat playable, I published the code. The goal wasn't really a production level game but something that demonstrated what could be done with the Circuit Playground board in a fun way.

I'm happy that you like the game!

Here are the actual contents of the file that I used to keep track of my game work.

Rules of the Original Simon Game

Game 1: Simon Says

For 1 or More Players

OBJECT: Repeat a longer and longer sequence of signals.

For a 1-Player Game

1. Press the GAME button. Press lens 1.
2. Press the LEVEL button. Choose a skill level and press the matching lens.
3. Press START
4. SIMON will give the first signal. Repeat the signal by pressing the same lens.
5. SIMON will duplicate the first signal and add one. Repeast these two signals by pressing the same lenses, in order.
6. SIMON will duplicate these first two signals and add one.
7. Continue playing as land as you can repeat each sequence of signals correctly. After the 5th, 9th, and 13 signals in a sequence, SIMON automatically speeds up.
8. If you fail to repeat a sequence exactly, or if you take more than 3 seconds to repeat a signal, SIMON responds with a RAZZ sound. This means you've lost, and the sequence of signals ends.


Repeat the maximum number of signals for skill levels 1, 2, or 3, and SIMON will salute you with six short signals for the last lens you pressed. Repeat 31 ignals in skill level 4, and SIMON will congratulate you with a special SIMON SALUTE!

To play again, press START.

Board layout:

Top of the game is the USB connector.
GREED LED is at 10 oclock
YELLOW LED is at 8 oclock
BLUE LED is at 4 oclock
RED LED is at 2 oclock
Left push button is start
Right push button is level select
Pad 2 is the GREEN lens
Pad 0 is the YELLOW lens
Pad 6 is the BLUE lens
Pad 9 is the RED lens

E-note (blue, lower right); 659.25
C♯-note (yellow, lower left); 554.37
A-note (red, upper right). 440
E-note (green, upper left, an octave lower than blue); 329.23


Find out how levels worked in the original game and document it
Implement levels


Light an LED color RED, GREEN, YELLOW, and BLUE.
Respond to a capacitive touch.
Debounce capacitive touch.
Play a tone when the button is down.
Bright lens when pressed otherwise the lens glows dimly.
Respond to a button click.
Have the game play a random tone and light the led.
Send a signal and keep track of it.
Light the led when the cap is pressed.
Play the tone when the cap is released. Background play sounds bad.
Randomize all the signals in advance and store in array.
Timeout if the answer not recieved in the allowed time

Posts: 6
Joined: Mon Dec 28, 2015 7:21 pm

Re: Simon Game

by sa0987 on Sun Aug 14, 2016 8:03 pm

Very impressive.

If you have time and I have time! I would love to test this out.

a) The code maker would press conductive pads till the selection is made (no black, but use blank as space, and another color, like purple)
b) press button 1 to hide the code
c) I have the python/PHP algorithm for the computer to break the code (average 5 guesses). The first guess would be made by the arduino.
d) code maker then presses the conducive pad to prove an answer to the
e) press button 2 to provide the answer
loop c-e continues till the computer guesses the answer.

the reverse can be made also where the computer makes the color selection, then you become the code breaker. (this might work better with less code)

Chat eventually, I won't have time till later this week when I am at the maker space. If I start, I will start a thread on it and post

Putting my thoughts here for a quick set of code.

Posts: 8
Joined: Thu May 21, 2015 2:27 pm

Please be positive and constructive with your questions and comments.