Let us now check, how the user follows along:
The easiest is to compare, if the user entered the same sequence as simon:
We compare how many notes simon has presented with how many buttons the user has clicked in this round and then we check if both "words", eg. strings we have build during gameplay, are the same. This is only done, when at least one character is within the strings.
We then play a nice sound, increase the score and prepare the next round by cleaning the user-values.
After a short wait of 2 seconds the next round is started by calling the function simonsLastWord again.
Since we want to know, when a user does a wron move, at the time he does and not at the end of his turn, we have to check substrings:
All strings are appended to the right, so we compare the leftsubstrings of simonSays and userSays up to the count of the userinput.
If this goes wrong, the according sound is played, the whole game is reset and the "Restart" button is set to visible.
This concludes this tutorial. If you need any more information, let me know.