Modified Gameplay for Simon Says (2)

Here comes a little improvement to the code that I’ve posted yesterday (see other post).

After playing a “faster” game of Simon Says this morning and winning at the first attempt, I thought it would be nice being able to combine a higher MOVES_TO_WIN value with faster gameplay. So I adjusted the code in order to make it possible to keep buttons BLUE and YELLOW or BLUE and GREEN pressed at boot-up at the same time. BLUE and YELLOW will start a high speed game with 30 moves to win, and BLUE combined with GREEN will be a slow game with 30 moves to win.

To achieve this, I modified the button checking code in function loop as follows:

/* changing replay speed in case GREEN or YELLOW button has been pressed */
/* and setting a higher MOVES_TO_WIN number when BLUE button was pressed */
if((button & LED_GREEN) > 0)
  replayDelay = 300;
else if((button & LED_YELLOW) > 0)
  replayDelay = 75;

if((button & LED_BLUE) > 0)
  MOVES_TO_WIN = 30;

You can download the complete new version here:

Comments are closed.