# Simon Says Help!

**URL:** https://forum.makecode.com/t/simon-says-help/3095
**Category:** Adafruit Circuit Playground Express
**Created:** [August 13, 2020, 1:57am UTC](https://forum.makecode.com/t/simon-says-help/3095 "2020-08-13T01:57:28Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![rymc88](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rymc88/32/13577_2.png) [@rymc88](https://forum.makecode.com/u/rymc88)
#### Post date: [August 13, 2020, 1:57am UTC](https://forum.makecode.com/t/simon-says-help/3095/1 "2020-08-13T01:57:28Z")

</div>

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).

Adafruit has an example of a code [https://learn.adafruit.com/simon-game-clone-with-circuitplayground-express-and-circuitpython/light-design](https://learn.adafruit.com/simon-game-clone-with-circuitplayground-express-and-circuitpython/light-design) but I figure out how to translate to blocks.

Here is what I have so far:

> **[Simon Says](https://makecode.adafruit.com/03208-13967-08750-04283)**
>
> Made with ❤️ in Adafruit Circuit Playground Express - Blocks / Javascript editor.

Thank you in advance for any help!

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [August 13, 2020, 3:32am UTC](https://forum.makecode.com/t/simon-says-help/3095/2 "2020-08-13T03:32:12Z")

</div>

Ooh! You’re giving me an excuse to dig out my Circuit Playground Express! Nice! Now, where did I put that thing…

Stay tuned! 😄

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [August 13, 2020, 4:24am UTC](https://forum.makecode.com/t/simon-says-help/3095/3 "2020-08-13T04:24:04Z")

</div>

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.

 ![circuitplayground-screenshot (1)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1b84bc5675bbb70084f730b2b5d16e760ae77242.png)

> **[Simon LEDs](https://makecode.adafruit.com/32708-70642-77761-47173)**
>
> Made with ❤️ in Adafruit Circuit Playground Express - Blocks / Javascript editor.

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [August 13, 2020, 4:50am UTC](https://forum.makecode.com/t/simon-says-help/3095/4 "2020-08-13T04:50:10Z")

</div>

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.

Here’s how I did it:

 ![circuitplayground-screenshot (2)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/c3374a70a5d7f7e2bf64e7755a70397b5198e867.png)

> **[Simon Touch](https://makecode.adafruit.com/84451-40626-96531-53484)**
>
> Made with ❤️ in Adafruit Circuit Playground Express - Blocks / Javascript editor.

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!

---

<div class="post-metadata">

### Author: ![rymc88](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rymc88/32/13577_2.png) [@rymc88](https://forum.makecode.com/u/rymc88)
#### Post date: [August 13, 2020, 7:11pm UTC](https://forum.makecode.com/t/simon-says-help/3095/5 "2020-08-13T19:11:12Z")

</div>

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.

Here it is:

> **[SimonSays](https://makecode.adafruit.com/14818-87332-19727-00100)**
>
> Made with ❤️ in Adafruit Circuit Playground Express - Blocks / Javascript editor.

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [August 13, 2020, 8:47pm UTC](https://forum.makecode.com/t/simon-says-help/3095/6 "2020-08-13T20:47:42Z")

</div>

YES! Good work!

---

<div class="post-metadata">

### Author: ![smagoun](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@smagoun](https://forum.makecode.com/u/smagoun)
#### Post date: [January 24, 2021, 3:38pm UTC](https://forum.makecode.com/t/simon-says-help/3095/7 "2021-01-24T15:38:41Z")

</div>

Maybe a bit late, but here’s a variant with a couple of changes:

- Moved the initialization into a ‘reset’ function to allow the game to restart after losing
- Added a better random number generator (since the built-in one always results in the same sequence, at least on my CPX)

> **[FSS CMC SimonSays](https://makecode.adafruit.com/66772-68647-57563-04546)**
>
> Made with ❤️ in Adafruit Circuit Playground Express - Blocks / Javascript editor.

---

<div class="post-metadata">

### Author: ![jimfalbo](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jimfalbo](https://forum.makecode.com/u/jimfalbo)
#### Post date: [March 14, 2022, 3:13pm UTC](https://forum.makecode.com/t/simon-says-help/3095/8 "2022-03-14T15:13:04Z")

</div>

Did you ever get this to work?

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [March 14, 2022, 7:00pm UTC](https://forum.makecode.com/t/simon-says-help/3095/9 "2022-03-14T19:00:01Z")

</div>

@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.

> [@Presenting: Simon Says](https://forum.makecode.com/t/presenting-simon-says/256):
>
> I’ve been holding onto this idea for a while, and I got around to writing it yesterday. It’s a very simple game that you probably have seen in many different forms. This week, I present Simon Says. Use the arrow keys to repeat the sequence created by the computer. Get any part of the sequence wrong and the game ends. I wasn’t planning on releasing this one to the forums at first. I came up with some extensions, though, that might be interesting for students to pursue. The game as-is might …
