Get in contact

posts/page

Simon Game – LEGO EV3 version – Damien Kee

Aug 6, 2015

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.

Get in Contact

  • Brenda Gahan - Head of Learning image

    Brenda Gahan - Head of Learning

    Sunshine Coast Grammar School
    star star star star star

    His wealth of knowledge and expertise allows him to tailor each workshop to the specific skill level and interests of the students (and teachers) and ensures that everyone is engaged and challenged.

  • Digital Technologies Teacher image

    Digital Technologies Teacher

    Victoria Point State High School
    star star star star star

    Students engaged in hands-on learning experiences that developed their problem-solving skills. It was a valuable and highly relevant real world learning opportunity.

  • Tammy Grady image

    Tammy Grady

    Senior Project Officer, QMEA
    star star star star star

    Through the Queensland Minerals and Energy Academy (QMEA), Damien has worked with hundreds of students and Teachers from across the State, all with varying levels of robotic and programming experience. Feedback from Damien’s workshops are always full of praise and appreciation, not only for his professional knowledge, but his adaptable teaching style and ease of delivery.

  • STEM Teacher - Years 7-10 image

    STEM Teacher - Years 7-10

    Tannum Sands State High School
    star star star star star

    Damien's professionalism and communications skills are superb. The very best educational expert visitor we have had come to the college.

  • Primary School Teacher - Year 5 image

    Primary School Teacher - Year 5

    Central Queensland Primary School
    star star star star star

    Damien's delivery style captivated students across every year level, from junior to senior. His depth of knowledge and genuine ability to tailor content to our students' abilities made a real difference, keeping everyone engaged and getting the most out of the experience regardless of their starting point.

  • Head of Curriculum image

    Head of Curriculum

    South East QLD Primary School
    star star star star star

    What stood out most was how thoroughly Damien customised the workshop to our school's specific needs. Rather than a one-size-fits-all session, he took the time to understand what we were after and delivered exactly that.