The ultimate memory game
Placed onStarting the game
We can use a button to start the game. I use button 1 to start. To let the player know that the game has started I created a short start animation where the LEDs go on 1 by 1. If you have done everything correctly and press button 1, the animation will start. Normally you could only press the button once.
Because nothing needs to be set I only show the main run.
lists
When we program we regularly use variables, but also often lists or Arrays. You can best see this as a book, where you have a title, with chapters below that all have a value. For example, in code it looks like this: order[] = ill use this function to store the sequence of LEDs. We also have storage for the number of 'chapters' or the length of the list.
apply lists
For starters, we're going to add a random number to the list each time.
We then use a piece of code to make the order of the LEDs go on and off each time
To see when it starts showing the sequence again I added this code at the end of the code: