Programming the Game Simon

Summary of Programming the Game Simon


This article details a final project programming the classic game Simon on an AT90S8535 microcontroller evaluation board. Players must memorize and repeat increasing sequences of lights and tones. The system utilizes features from previous labs, including a musical tone generator, and offers two difficulty levels: constant speed or increasing tempo. Game over occurs after 40 steps or upon player error, displaying the score in binary.

Parts used in the Simon Game Project:

  • AT90S8535 microcontroller chip
  • Corresponding evaluation board
  • Lights (LEDs)
  • Switches (Buttons)
  • Musical tone generator program

Introduction

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

Quick Solutions to Questions related to Simon Game Project:

  • What hardware is used to program the Simon game?
    The project uses the AT90S8535 microcontroller chip and its corresponding evaluation board.
  • How does the game increase in difficulty?
    Each time the player correctly repeats the sequence, one element is added to it.
  • Can the player choose different playing speeds?
    Yes, Level one has constant speed while Level two plays back notes at an increasing rate.
  • What happens when the player presses the wrong button?
    The game stops immediately, and the player loses.
  • What is the maximum length of the stored sequence?
    Play stops when the sequence reaches 40 numbers due to the defined RAM storage size.
  • How much time does the player have to press a button?
    The player must press the correct button within 2.1 seconds or they lose.
  • How is the final score displayed after losing?
    The level achieved is shown in binary on the LEDs.
  • Does the game play music during gameplay?
    Yes, a short starting melody plays at the beginning and a game over song plays when the player loses.

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:
LinkedinTwitter
Scroll to Top