Keeping track of players clicks in Simon says game and who's turn it is

Keeping track of players clicks in Simon says game and who's turn it is
0

#1

i am trying to find a solution having the computer check players clicks and see if it matches the original random choice array that a function called computerDisplay created. Could anyone please explain how i could have the computer check the array after each increment in the color patterns example starts with red stops check if player has clicked red and moves on with red and then new color yellow. Each time building a larger pattern of colors until twenty rounds have been reached. Here is my code up to date. https://codepen.io/Ajax-2031/pen/jGKMzj?editors=1111. im keeping track of random colors selection with classVariable array and players clicks with userClick array. This is the following method at w3schools(https://www.w3schools.com/jsref/jsref_every.asp) that i tried to check if arrays do match. I could not get it to return a true value if arrays did match.


#2

Hi AJAX204,
I did a bit of work cleaning up your code so its a bit easier to read. I changed names and functions as little as possible so that it essentially the same code. I annotated my changes in the code so you can understand where I changed things. Feel free to fork from this point, and erase what you have read and don’t need. https://codepen.io/moseschild/pen/zELMoj?editors=0011

If you need some ideas on how to write the playSequence function, you can check out mine :Simply Simon


#3

Thank you for replying i am still trying to figure out most of simon says game functionality as i am still somewhat of a beginner with most aspects in javascript and jquery.