Below is an example of a game of Simon Says: 


Game Play:

1. The game begins by Simon flashing the following pattern using the DMX RGB channels: Red, Blue, Green and Blue

2. Once Simon has completed his answer, it is then the user's turn to repeat his response, in which they will have 60 seconds to do so.

3. When the timer is up, Simon will check the answer. If the user has answered correctly, "Congrats!" will appear on the display along with a green light from the DMX. If the answer is wrong, however, "Incorrect!" will appear on the display along with a red light from the DMX.


The content of the Control.ini looks like this:


1     !vcc1=0!edv1:0#

2     !vcc1=0!edv2:0#

3     !vcc1=0!edv3:0#

4     !vcc1=2!edv1:255#

5     !vcc1=2!edv2:0#

6     !vcc1=2!edv3:0#

7     !vcc1=3!edv1:0#

8     !vcc1=3!edv2:255#

9     !vcc1=3!edv3:0#

10   !vcc1=7!edv1:0#

11   !vcc1=7!edv2:0#

12   !vcc1=7!edv3:255#

13   !vcc1=9!edv1:0#

14   !vcc1=9!edv2:0#

15   !vcc1=9!edv3:255#

16   !vcc1=12!edv1:0#

17   !vcc1=12!edv2:255#

18   !vcc1=12!edv3:0#

19   !vcc1=19!edv1:0#

20   !vcc1=19!edv2:0#

21   !vcc1=19!edv3:255#

22   !tm00:01!vmc3=0#

23   !tm00:01!vmc2=0#

24   !tm00:02!vmc1=2#

25   !tm00:03!vmc1=7#

26   !tm00:04!vmc1=3#

27   !tm00:05!vmc1=7#

28   !tm00:06!vmc1=0#

29   !tm00:07!mmd255:"Your Turn!"#

30   !tm00:07!vmc3=2#

31   !tm00:08!mmd255:"60 Seconds!"#

32   !tm00:18!mmd255:"50 Seconds!"#

33   !tm00:28!mmd255:"40 Seconds!"#

34   !tm00:38!mmd255:"30 Seconds!"#

35   !tm00:48!mmd255:"20 Seconds!"#

36   !tm00:58!mmd255:"10 Seconds!"#

37   !tm01:08!mmd255:"Time is Up!"#

38   !i1c!vmc2+2#

39   !i3c!vmc2+3#

40   !i2c!vmc2+7#

41   !t&00:03!vcc3=2!vmv1=2#

42   !tm01:13!vmc3=1#

43   !vcc2=19!vcc3=1!mmd225:"Congrats!"#

44   !vcc2=19!vcc3=1!vmc1=3#

45   !vcc2<19!vcc3=1!mmd225:"Incorrect!"#

46   !vcc2<19!vcc3=1!vmc1=2#

47   !vcc2>19!vcc3=1!mmd225:"Incorrect!"#

48   !vcc2>19!vcc3=1!vmc1=2#


Line 1:   When variable 1 equals a value of 0, set the R value on the DMX to 0 (to turn off display)

Line 2:   When variable 1 equals a value of 0, set the G value on the DMX to 0 (to turn off display)

Line 3:   When variable 1 equals a value of 0, set the B value on the DMX to 0 (to turn off display)

Line 4:   When variable 1 equals a value of 2, set the R value on the DMX to 255 (to display red)

Line 5:   When variable 1 equals a value of 2, set the G value on the DMX to 0 (to display red)

Line 6:   When variable 1 equals a value of 2, set the B value on the DMX to 0 (to display red)

Line 7:   When variable 1 equals a value of 3, set the R value on the DMX to 0 (to display green)

Line 8:   When variable 1 equals a value of 3, set the G value on the DMX to 255 (to display green)

Line 9:   When variable 1 equals a value of 3, set the B value on the DMX to 0 (to display green)  

Line 10: When variable 1 equals a value of 7, set the R value on the DMX to 0 (to display blue)

Line 11: When variable 1 equals a value of 7, set the G value on the DMX to 0 (to display blue)

Line 12: When variable 1 equals a value of 7, set the B value on the DMX to 255 (to display blue)

Line 13: When variable 1 equals a value of 9, set the R value on the DMX to 0 (to display blue)

Line 14: When variable 1 equals a value of 9, set the G value on the DMX to 0 (to display blue)

Line 15: When variable 1 equals a value of 9, set the B value on the DMX to 255 (to display blue)

Line 16: When variable 1 equals a value of 12, set the R value on the DMX to 0 (to display green)

Line 17: When variable 1 equals a value of 12, set the G value on the DMX to 255 (to display green)

Line 18: When variable 1 equals a value of 12, set the B value on the DMX to 0 (to display green)

Line 19: When variable 1 equals a value of 19, set the R value on the DMX to 0 (to display blue)

Line 20: When variable 1 equals a value of 19, set the G value on the DMX to 0 (to display blue)

Line 21: When variable 1 equals a value of 19, set the B value on the DMX to 255 (to display blue)

Line 22: When the Start Up Time Delay is 00:01 (1 second), disable the Check Answer flag (variable 3) 

Line 23: When the Start Up Time Delay is 00:01, set variable 2 equal to 0

Line 24: When the Start Up Time Delay is 00:02, Simon says Red

Line 25: When the Start Up Time Delay is 00:03, Simon says Blue

Line 26: When the Start Up Time Delay is 00:04, Simon says Green

Line 27: When the Start Up Time Delay is 00:05, Simon says Blue

Line 28: When the Start Up Time Delay is 00:06, the light is turned off

Line 29: When the Start Up Time Delay is 00:07, "Your Turn!" is displayed 

Line 30: When the Start Up Time Delay is 00:07, set variable 3 equal to 2

Line 31: When the Start Up Time Delay is 00:08, start the game's timer at 60 seconds

Line 32: When the Start Up Time Delay is 00:18, update the timer value to 50 seconds

Line 33: When the Start Up Time Delay is 00:28, update the timer value to 40 seconds

Line 34: When the Start Up Time Delay is 00:38, update the timer value to 30 seconds

Line 35: When the Start Up Time Delay is 00:48, update the timer value to 20 seconds

Line 36: When the Start Up Time Delay is 00:58, update the timer value to 10 seconds

Line 37: When the Start Up Time Delay is 01:08, the timer is up

Line 38: If input 1 is closed (!i1c) increment variable 2 by a value of 2

Line 39: If input 3 is closed (!i3c) increment variable 2 by a value of 3

Line 40: If input 2 is closed (!i2c) increment variable 2 by a value of 7

Line 41: Every 3 seconds, set variable 1 equal to 2 if variable 3 equals 2

Line 42: When the Start Up Time Delay is 01:13, enable the Check Answer flag (variable 3)

Line 43: If variable 2 is equal to 19 and variable 3 equals 1, the user has correctly repeated Simon so display "Congrats!" and set the DMX to Green

Line 44: If variable 2 is equal to 19 and variable 3 equals 1, the user has correctly repeated Simon so set the DMX to Green

Line 45: If variable 2 is less than 19 and variable 3 equals 1, the user has incorrectly repeated Simon so display "Incorrect!"

Line 46: If variable 2 is less than 19 and variable 3 equals 1, the user has correctly repeated Simon so set the DMX to Red

Line 47: If variable 2 is greater than 19 and variable 3 equals 1, the user has incorrectly repeated Simon so display "Incorrect!"

Line 48: If variable 2 is greater than 19 and variable 3 equals 1, the user has correctly repeated Simon so set the DMX to Red


Now it's your turn!


The example above contains two problems:


1. The current code allows for all possible combinations of the correct colors but does not verify that the user's response is of the correct permutation. For example, Simon will accept an answer of Green, Blue, Blue, Red even though the correct answer is Red, Blue, Green, Blue because it contains one Red response, one Green response and two Blue responses. Can you modify the code to check for the correct order?


2. The code above takes a rather roundabout approach to achieve a game of Simon Says. How would you take a more simplified and straightforward approach to this problem?