mainclock pygame time clock( displaysurf pygame display set_mode((windowwidthwindowheight) pygame display set_caption('flippy' font pygame font font('freesansbold ttf' bigfont pygame font font('freesansbold ttf' set up the background image boardimage pygame image load('flippyboard png' use smoothscale(to stretch the board image to fit the entire board boardimage pygame transform smoothscale(boardimage(boardwidth spacesizeboardheight spacesize) boardimagerect boardimage get_rect( boardimagerect topleft (xmarginymargin bgimage pygame image load('flippybackground png' use smoothscale(to stretch the background image to fit the entire window bgimage pygame transform smoothscale(bgimage(windowwidthwindowheight) bgimage blit(boardimageboardimagerect run the main game while true if rungame(=false break def rungame() plays single game of reversi each time this function is called reset the board and game mainboard getnewboard( resetboard(mainboard showhints false turn random choice(['computer''player'] draw the starting board and ask the player what color they want drawboard(mainboard playertilecomputertile enterplayertile( make the surface and rect objects for the "new gameand "hintsbuttons newgamesurf font render('new game'truetextcolortextbgcolor newgamerect newgamesurf get_rect( newgamerect topright (windowwidth hintssurf font render('hints'truetextcolortextbgcolor email questions to the authoral@inventwithpython com