solving slide puzzle can be really tricky we could program the computer to do itbut that would require us to figure out an algorithm that can solve the slide puzzle that would be very difficult and involve lot of cleverness and effort to put into this program fortunatelythere' an easier way we could just have the computer memorize all the random slides it made when it created the board data structureand then the board can be solved just by performing the opposite slide since the board originally started in the solved stateundoing all the slides would return it to the solved state for examplebelow we perform --right|slide on the board on the left side of the pagewhich leaves the board in the state that is on the right side of the pageafter the right slideif we do the opposite slide ( left slidethen the board will be back in the original state so to get back to the original state after several slideswe just have to do the opposite slides in reverse order if we did right slidethen another right slidethen down slidewe would have to do an up slideleft slideand left slide to undo those first three slides this is much easier than writing function that can solve these puzzles simply by looking at the current state of them the main game loop while truemain game loop slideto none the directionif anya tile should slide msg 'contains the message to show in the upper left corner if mainboard =solvedboardmsg 'solved!drawboard(mainboardmsgin the main game loopthe slideto variable will track which direction the player wants to slide tile (it starts off at the beginning of the game loop as none and is set laterand the msg variable tracks what string to display at the top of the window the program does quick check on line to see if the board data structure has the same value as the solved board data structure stored in solvedboard if sothen the msg variable is changed to the string 'solved!email questions to the authoral@inventwithpython com