so instead we will have the for loop iterate from to tilesize by several pixels each frame the number of pixels it jumps over is stored in animationspeedwhich is passed in when slideanimation(is called for exampleif animationspeed was set to and the constant tilesize was set to then the for loop and range( tilesizeanimationspeedwould set the variable to the values (it does not include because the range(function goes up tobut not includingthe second argument this means the entire sliding animation would be done in frameswhich would mean it is done in / th of second ( third of secondsince the game runs at fps lines to makes sure that we draw the tile sliding in the correct direction (based on what value the direction variable hasafter the animation is donethen the function returns notice that while the animation is happeningany events being created by the user are not being handled those events will be handled the next time execution reaches line in the main(function or the code in the checkforquit(function creating new puzzle def generatenewpuzzle(numslides) from starting configurationmake numslides number of moves (and animate these moves sequence [ board getstartingboard( drawboard(board'' pygame display update( pygame time wait( pause milliseconds for effect the generatenewpuzzle(function will be called at the start of each new game it will create new board data structure by calling getstartingboard(and then randomly scramble it the first few lines of generatenewpuzzle(get the board and then draw it to the screen (freezing for half second to let the player see the fresh board for moment lastmove none for in range(numslides) move getrandommove(boardlastmove slideanimation(boardmove'generating new puzzle 'int(tilesize ) makemove(boardmove sequence append(move lastmove move return (boardsequencethe numslides parameter will show tell the function how many of these random moves to make the code for doing random move is the getrandommove(call on line to get the