see if the player might have clicked on the resetnewor solve buttons (which are not located on the boardthe coordinates of where these buttons are on the window are stored in the pygame rect objects that are stored in the reset_rectnew_rectand solve_rect variables we can pass the mouse coordinates from the event object to the collidepoint(method this method will return true if the mouse coordinates are within the rect object' area and false otherwise sliding tiles with the mouse elsecheck if the clicked tile was next to the blank spot blankxblanky getblankposition(mainboardif spotx =blankx and spoty =blankyslideto left elif spotx =blankx and spoty =blankyslideto right elif spotx =blankx and spoty =blanky slideto up elif spotx =blankx and spoty =blanky slideto down if getspotclicked(did not return (nonenone)then it will have returned tuple of two integer values that represent the and coordinate of the spot on the board that was clicked then the if and elif statements on lines to check if the spot that was clicked is tile that is next to the blank spot (otherwise the tile will have no place to slideour getblankposition(function will take the board data structure and return the and board coordinates of the blank spotwhich we store in the variables blankx and blanky if the spot the user clicked on was next to the blank spacewe set the slideto variable with the value that the tile should slide sliding tiles with the keyboard elif event type =keyup check if the user pressed key to slide tile if event key in (k_leftk_aand isvalidmove(mainboardleft) slideto left elif event key in (k_rightk_dand isvalidmove(mainboardright) slideto right email questions to the authoral@inventwithpython com