LEGO® MINDSTORMS® and Technic®MINDSTORMS® EV3/NXTMINDSTORMS SensorsLEGO® technical dataLDrawMiscellaneous LEGO®LEGO® & PhotographyPanoramic PhotographyPhoto GalleryHome

 

 

     
    Brick Simon, a memory game

     

    Brick Simon was placed second
    in CC6: Simon contest

     

     

    Here is my entry for the Mindstorms COMMUNITY CONTEST # 6: Simon.

    You may have a look to other contestant's clever entries here.

    I wished to keep a true 4 keys keyboard for ease of use. A few constructions later, I was convinced that I needed all three sensors to get a reliable keyboard.

    No sensors left for the display function!

    So I built this keyboard module. Keys are linked two by two by a rubber band loaded lever to keep them up.

    The two keys on the left release the pressure on two touch sensors.

    The light sensor on the right sees black when no key is pressed, grey or yellow when one of them is pressed.

    The keyboard unit, integrated in Brick Simon.

    This prototype of the display unit shows how I obtained 4 states: the left motor can make one turn, the right motor only a half turn. The differential adds these movements, when both motors are on a stop its body can have 4 positions: 0 turn, 1/4 turn, 1/2 turn and 3/4 turn. Originally, I used white clutch gears, but they were still too stiff and I had to use very low motor power settings (0 and 1). You may have to increase these values to 1 and 2 if you use the new 43362 motors with higher friction.

    The display module, integrated in Brick Simon.

     

  • Brick Simon User's manual

    1) Compile and download Simon.nqc in program slot 1, and InitHighScore.nqc in program slot 2. This can be done using BricxCC, you can get it from http://bricxcc.sourceforge.net/.

    2) Run program 2, this will initialize all high scores to 5, then automatically launch Brick Simon program (slot 1). This initialization should be performed only once to preserve high scores between runs, after that launch program 1 directly.

    3) Brick Simon will first ask for the play difficulty level. RCX LCD shows a walking 1234 pattern, waiting for a key to be pressed.

    - Level 1 (blue key): The easy one. The random color chooser is biased to produce regular sequences. The same color can't happen twice successively. High time out on the keyboard (20 seconds)
    - Level 2 (red key): The same color can't happen twice successively. Keyboard time out = 2s
    - Level 3 (yellow key): Color order is truely random. Keyboard time out = 1s
    - Level 4 (green key): The hardest level. Color order is truely random. Keyboard time out = 0.4s

    A separate high score is kept for each difficulty level.

    The chosen difficulty level is then displayed as 1111, 2222, 3333 or 4444, the RCX plays a little tune and the game begins.

    4) Simon asks you to repeat a longer and longer color sequence (a new color is added at the end of sequence after you repeat it successfully on the keyboard). Its hand turns on the dial to show colors and plays a note (different for each color). You then have to key in the sequence in order. RCX LCD displays current sequence length (2 digits left) and high score sequence length to beat (2 digits right), separated by a dot.

    When you reach high score, Brick Simon plays a short tune to tell you...

    5) When you finally lose, either because you hit a wrong key or waited too long (doh sound), program is halted. Press RCX Run button to start a new game!

  • Program
    The programs were written in .

    Get the high score initialization program, and the Brick Simon program.

    Tips and tricks used by this program:
    - in NQC, static variables (declared outside all program modules) are remembered even when the RCX is off. This is how high scores are kept. Moreover, the compiler assigns static variables in successive order, so Simon.nqc can use the values set by InitHighScore.nqc.

    - There is no need to remember the random color sequence. Each time the color sequence must be generated again, NQC random number generator is re-initialized using the same seed, with SetRandomSeed(Seed_value) instruction.

    As no fancy parts were used in Brick Simon, it was not too difficult to build a simplified version using only parts included in Robotics Invention System. This version comes in three separate units (keyboard, display, RCX). Unfortunately, RIS does not contain colored tiles, so the display is a bit... dull!

    RIS Simon uses the same programs as his elder brother.
     


    RIS Simon display unit.

    RIS Simon keyboard unit.

 

LEGO® MINDSTORMS® and Technic®MINDSTORMS® EV3/NXTMINDSTORMS SensorsLEGO® technical dataLDrawMiscellaneous LEGO®LEGO® & PhotographyPanoramic PhotographyPhoto GalleryHome