I am trying to figure a way out to make a Simon Says game on the CPX using blocks. I want to divide pixels into 4 sections, one for each of the colors (0-2 = red, 2-4 = blue, 5-7 = yellow, 7-9 = green), but I cannot figure a way to do that.
What I have is a way to add to the pattern and how to show the pattern (maybe).
So, I used a simpler way to activate the LEDs using show ring. Feel free to alter the colors to your liking; I used the colors and locations used in the Adafruit article that you mentioned. Yes, you could do the same thing with a bit of math, but this just feels like it fits better with the Blocks environment.
Now, we can handle the touch sensors. I added a variable, acceptInput, which is checked before the touch is processed. Right now, acceptInput is simply set to true. You donāt always want to be accepting input during the game, though, so weāll need a way to ignore player input later.
Because weāve assigned each color a number, when youāre building Simonās sequence and accepting player input, you just need to use the numbers 1 through 4 instead of trying to create an array of colors or light patterns.
Iāll stop here for now so that you can give it a go. Good luck!
So I was stuck on trying to have the player input the entire sequence before comparing it with the game sequence. Is there a way to the compare the values of two arrays using blocks? Eventually realized you have to check after every button press.
@rymc88 's version works well (I just tested it again in case I had forgotten), and it looks like @smagoun added a couple of useful enhancements. I also have a version for MakeCode Arcade in a separate thread.