score - lastscorededuction time time( drawscore(score pygame display update( fpsclock tick(fps def getswappinggems(boardfirstxysecondxy) if the gems at the (xycoordinates of the two gems are adjacent then their 'directionkeys are set to the appropriate direction value to be swapped with each other otherwise(nonenoneis returned firstgem {'imagenum'board[firstxy[' ']][firstxy[' ']] ' 'firstxy[' '] ' 'firstxy[' '] secondgem {'imagenum'board[secondxy[' ']][secondxy[' ']] ' 'secondxy[' '] ' 'secondxy[' '] highlightedgem none if firstgem[' '=secondgem[' ' and firstgem[' '=secondgem[' '] firstgem['direction'left secondgem['direction'right elif firstgem[' '=secondgem[' ' and firstgem[' '=secondgem[' '] firstgem['direction'right secondgem['direction'left elif firstgem[' '=secondgem[' ' and firstgem[' '=secondgem[' '] firstgem['direction'up secondgem['direction'down elif firstgem[' '=secondgem[' ' and firstgem[' '=secondgem[' '] firstgem['direction'down secondgem['direction'up else these gems are not adjacent and can' be swapped return nonenone return firstgemsecondgem def getblankboard() create and return blank board data structure board [ for in range(boardwidth) board append([empty_spaceboardheight