Brick Simon, a memory game -------------------------- Here is my entry for the Mindstorms COMMUNITY CONTEST # 6: Simon. More details, photos, movies: http://philohome.com/simon/bricksimon.htm 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! Keyboard module --------------- Keys are linked two by two by a rubber band loaded lever to keep them up. Two keys release the pressure on two touch sensors. The remaining two keys are detected by a light sensor that sees black when no key is pressed, grey or yellow when one of them is pressed. Display unit ------------ The 4 states display unit uses two motors and a differential. One motor can make one turn, the other 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. 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 . Tips and tricks used by the 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. RIS Simon --------- 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!