fpsclock tick(fps def generaterevealedboxesdata(val) revealedboxes [ for in range(boardwidth) revealedboxes append([valboardheight return revealedboxes def getrandomizedboard() get list of every possible shape in every possible color icons [ for color in allcolors for shape in allshapes icons append(shapecolor random shuffle(iconsrandomize the order of the icons list numiconsused int(boardwidth boardheight calculate how many icons are needed icons icons[:numiconsused make two of each random shuffle(icons create the board data structurewith randomly placed icons board [ for in range(boardwidth) column [ for in range(boardheight) column append(icons[ ] del icons[ remove the icons as we assign them board append(column return board def splitintogroupsof(groupsizethelist) splits list into list of listswhere the inner lists have at most groupsize number of items result [ for in range( len(thelist)groupsize) result append(thelist[ : groupsize] return result def lefttopcoordsofbox(boxxboxy) convert board coordinates to pixel coordinates left boxx (boxsize gapsizexmargin email questions to the authoral@inventwithpython com