Simon Game - Not running game logic

Simon Game - Not running game logic


I have established some JS code that, in my mind, should work. However, the code that will iterate and increase the order of random color sequences does not run. The code plays the first color sequence, waits for the user to click, and even registers the right and wrong clicks, but after that, it does not continue the game. This is the last thing before I get my front-end cert, and I am really hoping to get it done soon. No one in the front-end help chat has replied to any of my requests, so I’m seeking help here. I’ve determined that the code gets just inside the if statement that determines if the number of clicks the user has made is equal to the number of turns the computer has generated but fails to run the for loop that checks each one for accuracy. The console.log()'s might be helpful in explaining what each bit of code is doing, but they were mostly checkpoints for me to see where the code is failing, so I understand if some of the code needs clarification.


First off, your css is broken so take care of it as soon as you’re done with the js

Since there isn’t any pseudocode it’s hard to determine which code does which, but I did notice this very important code is missing. Study it, it’s the key to how to proceed from one level to the next. Good luck.


Well, this is the perfect opportunity for you to learn how to debug a program.


Your codepen seems to have everything dumped in the HTML section.
Defeats the point of codepen really.
I recommend you read this:

Hmm. 7 months after you posted :roll_eyes:


Ha ha thank you. I did eventually get the logic running, however I did a rebuild about a month ago and uploaded it to GitHub, with everything in one file. So I just copied and pasted the doc into the html section of the Codepen. Thanks for your concern though!