Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
steps/psuedocode for Simon Game
main code sequence
1. click start
1. since start boolean is false, it will
2. toggle to true, and start the game
2. start game
3. add random color to sequence
1. out of array of 4 colors, pick one at random
2. push into array of computer sequence
4. increase turn count to 1
5. play sequence method
6. have user input count at 0
7. click on a button - onClick method
1. check if clickable boolean is at true. if so,
1. toggle color which uses clicked color - method
2. check user input which uses clicked color - method
play sequence method
1. if clickable is true, toggle to false.
2. create i iterator at 0
3. toggle color which uses color in generated sequence
4. increate iterator
5. check if iterator matches the sequence's length
1. if so, stop loop and make buttons clickable
6. delay next iteration by 1 second
7. if clickable is false, toggle to true.
toggle color method
1. get index of color
2. splice array with highlighted color
3. play sound which uses color
4. get index of highlight color
5. splice again to return to normal color
check user input method
1. using player input count as an index for the sequence have it be the expected color
2. check if the clicked color matches the expected color. if so,
1. increase player input count
2. method to check if turn is over
1. if not, it is a mismatch
1. play sequence again
isTurnOver method
1. create a boolean for matching if sequence length matches the player input count to check if
2. if its true
1. reset input count
2. increase turncount
3. add another color to sequence
4. play sequence
clickable boolean chain
1. start at false
2. check if true before sequence is played and toggle to false if so.
3. check if false after sequence is played and toggle to true if so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.