Search
About

Damien works with students and teacher from around the world, bringing the effective use of technology to the classroom.  

LEGO MINDSTORMS
Damien is a member of the MCP (Mindstorms Community Program), a small group of experts who collaborate with LEGO to make the MINDSTORM product better.

VEX IQ Robotics
Damien is a member of the VEX IQ Super User group, a small group of experts who collaborate with VEX to make the VEX IQ platform a better product 

 

Books

Teacher Resource Books

Global Map

See where the DomaBot and RileyRover is being used around the world

« Simon Game - VEX-IQ version | Main | Workshop EV3 Quick Build »
Thursday
Aug062015

Simon Game - LEGO EV3 version

 

The game of Simon has been popular for many years.  The basic premise is this:
Device does an action (display a light, plays a sound etc.)  Player has to repeat the action (press a button corresponding to the light/sound etc).  The device then does the original action plus a new action.  Player has to repeat the sequence.  Each time the player gets the sequence right, the device adds another action onto the sequence making it harder and harder to remember.

This is my EV3 version of the Simon Game.

Hardware:

I'm using 3 colour sensors to represent the actions that the device can show.  If you set the Colour sensor to measure ambient intensity, the LED inside glows blue.  If you set it to measure reflected intensity, then it glows red.  I'll be using these as flashing lights only, and am not interested in the actual sensor readings that they generate.

I'm using the Brick buttons (left, centre, right) as the player inputs.  If the left Colour Sensor goes red, that means the Player has to press the left Brick Button to match the sequence.  

Software:

Initialisation

Create a Numeric Variable Array and set it to 0

Set each Colour Sensor to be in Ambient mode (showing a blue light)

Generate sequence
Create a Random number, between 1 and 3, and append it to array (append is a fancy way of saying tack on a new number to the end of the array).  

I then show on the EV3 screen the length of the array to let the Player know what level they're up to.  If the array/sequence is 5 actions long, then they are on Level 5.
Take the random number, if it is 1, play a low note and briefly change Colour Sensor 1 to red and then back to blue.  If the random number is 2 or 3, play a medium / high note and flash the appropriate Colour Sensor.
Repeat this process as many times as there are numbers in the array.  ie. If the array/sequence is 6 numbers long, then repeat this 6 times.

 

Check the sequence
Wait for either the Left, Centre or Right Brick button to be pressed.  Each button represents a number, and this number is checked with the equivalent position in the array.  If the numbers are equal, it means the Player pressed the right button for that part of the sequence.  A brief high pitched note is played to indicate success and the next number in the sequence is checked.  If the numbers don't matched, then it means they got it out of sequence.  A suitable sound is played and the main loop is interrupted (exited).  The score stays on screen for 5 seconds so you can see what level you got to.

 

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>