actually performing the tile slide if slideto slideanimation(mainboardslideto'click tile or press arrow keys to slide ' show slide on screen makemove(mainboardslideto allmoves append(slidetorecord the slide pygame display update( fpsclock tick(fpsnow that the events have all been handledwe should update the variables of the game state and display the new state on the screen if slideto has been set (either by the mouse event or keyboard event handling codethen we can call slideanimation(to perform the sliding animation the parameters are the board data structurethe direction of the slidea message to display while sliding the tileand the speed of the sliding after it returnswe need to update the actual board data structure (which is done by the makemove(functionand then add the slide to the allmoves list of all the slides made so far this is done so that if the player clicks on the --reset|buttonwe know how to undo all the player' slides idle and terminating pygame programs def terminate() pygame quit( sys exit(this is function that we can call that calls both the pygame quit(and sys exit(functions this is bit of syntactic sugarso that instead of remembering to make both of these callsthere is just single function we can call instead checking for specific eventand posting events to pygame' event queue def checkforquit() for event in pygame event get(quit)get all the quit events terminate(terminate if any quit events are present email questions to the authoral@inventwithpython com