right 'right empty_space - an arbitrarynonpositive value rowaboveboard 'row above boardan arbitrarynoninteger value def main() global fpsclockdisplaysurfgemimagesgamesoundsbasicfontboardrects initial set up pygame init( fpsclock pygame time clock( displaysurf pygame display set_mode((windowwidthwindowheight) pygame display set_caption('gemgem' basicfont pygame font font('freesansbold ttf' load the images gemimages [ for in range( numgemimages+ ) gemimage pygame image load('gem% pngi if gemimage get_size(!(gemimagesizegemimagesize) gemimage pygame transform smoothscale(gemimage(gemimagesizegemimagesize) gemimages append(gemimage load the sounds gamesounds { gamesounds['bad swap'pygame mixer sound('badswap wav' gamesounds['match'[ for in range(nummatchsounds) gamesounds['match'append(pygame mixer sound('match% wavi) create pygame rect objects for each board space to do board-coordinate-to-pixel-coordinate conversions boardrects [ for in range(boardwidth) boardrects append([] for in range(boardheight) pygame rect((xmargin ( gemimagesize) ymargin ( gemimagesize) gemimagesize gemimagesize) boardrects[xappend( while true rungame(