for exampleif pattern was set to [yellowredredand the currentstep variable was set to (like it would be when the player first starts the game)then the correct button for the player to click would be pattern[ (the yellow buttonif the player has clicked on the correct buttonwe want to flash the button the player clicked by calling flashbuttonanimation(thenincrease the currentstep to the next stepand then update the lastclicktime variable to the current time (the time time(function returns float value of the number of seconds since january st so we can use it to keep track of time if currentstep =len(pattern)pushed the last button in the pattern changebackgroundanimation(score + waitingforinput false currentstep reset back to first step lines to are inside the else statement that started on line if the execution is inside that else statementwe know the player clicked on button and also it was the correct button line checks if this was the last correct button in the pattern list by checking if the integer stored in currentstep is equal to the number of values inside the pattern list if this is truethen we want to change the background color by calling our changebackgroundanimation(this is simple way to let the player know they have entered the entire pattern correctly the score is incrementedcurrentstep is set back to and the waitingforinput variable is set to false so that on the next iteration of the game loop the code will add new color value to the pattern list and then flash the buttons elif (clickedbutton and clickedbutton !pattern[currentstep]or (currentstep ! and time time(timeout lastclicktime)if the player did not click on the correct buttonthe elif statement on line handles the case where either the player clicked on the wrong button or the player has waited too long to click on button either waywe need to show the --game over|animation and start new game the (clickedbutton and clickedbutton !pattern[currentstep]part of the elif statement' condition checks if button was clicked and was the wrong button to click you can compare this to line ' if statement' condition clickedbutton and clickedbutton =pattern[currentstepwhich evaluates to true if the player clicked button and it was the correct button to click email questions to the authoral@inventwithpython com