board[gem[' ']][ gem['imagenum'move to top row def fillboardandanimate(boardpointsscore) dropslots getdropslots(board while dropslots ![[]boardwidth do the dropping animation as long as there are more gems to drop movinggems getdroppinggems(board for in range(len(dropslots)) if len(dropslots[ ]! cause the lowest gem in each slot to begin moving in the down direction movinggems append({'imagenum'dropslots[ ][ ]' ' ' 'rowaboveboard'direction'down} boardcopy getboardcopyminusgems(boardmovinggems animatemovinggems(boardcopymovinggemspointsscore movegems(boardmovinggems make the next row of gems from the drop slots the lowest by deleting the previous lowest gems for in range(len(dropslots)) if len(dropslots[ ]= continue board[ ][ dropslots[ ][ del dropslots[ ][ def checkforgemclick(pos) see if the mouse click was on the board for in range(boardwidth) for in range(boardheight) if boardrects[ ][ycollidepoint(pos[ ]pos[ ]) return {' ' ' ' return none click was not on the board def drawboard(board) for in range(boardwidth) for in range(boardheight) pygame draw rect(displaysurfgridcolorboardrects[ ][ ] gemtodraw board[ ][ if gemtodraw !empty_space displaysurf blit(gemimages[gemtodraw]boardrects[ ][ ]