makemove(boardmove sequence append(move lastmove move return (boardsequence def resetanimation(boardallmoves) make all of the moves in allmoves in reverse revallmoves allmoves[:gets copy of the list revallmoves reverse( for move in revallmoves if move =up oppositemove down elif move =down oppositemove up elif move =right oppositemove left elif move =left oppositemove right slideanimation(boardoppositemove''int(tilesize ) makemove(boardoppositemove if __name__ ='__main__' main(second versesame as the first much of the code in wormy is similar to the previous games we've looked atespecially the constants being set at the start of the code slide puzzle by al sweigart al@inventwithpython com creative commons by-nc-sa us import pygamesysrandom from pygame locals import create the constants (go ahead and experiment with different values boardwidth number of columns in the board boardheight number of rows in the board tilesize windowwidth