square 'square diamond 'diamond lines 'lines oval 'oval allcolors (redgreenblueyelloworangepurplecyan allshapes (donutsquarediamondlinesoval assert len(allcolorslen(allshapes >boardwidth boardheight"board is too big for the number of shapes/colors defined def main() global fpsclockdisplaysurf pygame init( fpsclock pygame time clock( displaysurf pygame display set_mode((windowwidthwindowheight) mousex used to store coordinate of mouse event mousey used to store coordinate of mouse event pygame display set_caption('memory game' mainboard getrandomizedboard( revealedboxes generaterevealedboxesdata(false firstselection none stores the (xyof the first box clicked displaysurf fill(bgcolor startgameanimation(mainboard while truemain game loop mouseclicked false displaysurf fill(bgcolordrawing the window drawboard(mainboardrevealedboxes for event in pygame event get()event handling loop if event type =quit or (event type =keyup and event key =k_escape) pygame quit( sys exit( elif event type =mousemotion mousexmousey event pos elif event type =mousebuttonup mousexmousey event pos mouseclicked true boxxboxy getboxatpixel(mousexmouseyemail questions to the authoral@inventwithpython com