Programming the Game Simon


Many of the simpler electronic games of the past decade can be easily programmed on the AVR microcontrollers we are using this semester, using only the lights and switches available on the evaluation boards. For our final project we programmed the game Simon using the AT90S8535 microcontroller chip and corresponding evaluation board. This is a simple computer game involving remembering a sequence of lights which are generated by the program, and repeating them back to the program in the correct order by pressing the correct sequence of buttons. Each time the player correctly repeats back the sequence, the sequence is increased by one element.
Programming the Game Simon
This project, as well as giving us a chance to design a fun game, gave us the opportunity to use several pieces of programs which we had developed for previous labs throughout the semester. In particular, many features of the musical tone generator which we developed for lab 3 were very useful for this project. Using the 8535 also gave us an opportunity to use a new evaluation board, which we had not used in previous labs.

User Interface: Playing the Game

After the program is started (either by turning on the evaluation board or pressing reset), the LED’s all flash on and off, notifying the player that the game is starting, and a short starting melody is played. The game then turns on LED’s 1 and 2, and waits until the player selects a level before starting the game. Level one has a constant playing speed while level two plays back the sequence of notes at an increasing rate as play continues.
Playing the Game
The game then randomly selects a number which is mapped to an LED which lights up while the corresponding tone is sounded. After playing the note, the game waits for the user to press the matching button. If the person presses the correct button, the program plays the previous string of lights and tones, selects the next random number, lights up the new LED while playing the corresponding tone, and waits for the player to press the correct sequence of buttons. As long as the player continues to press the correct sequence of switches without running out of time, the game will continue. Play stops when the playback sequence contains 40 numbers, which is the defined RAM storage size for the array of numbers, or the person looses. The player looses by either pressing the wrong button or taking longer then 2.1 seconds to press the correct button. When either of those things occur, the player looses the game, the level that the player was on, that is, the length of the stored sequence, is shown in binary on the LED’s, and a short ‘game over’ song is played. A flow chart describing how our program works is provided below.

For more detail: Programming the Game Simon

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top