def translateboardtopixelcoord(xy) return xmargin spacesize int(spacesize )ymargin spacesize int(spacesize def animatetilechange(tilestofliptilecoloradditionaltile) draw the additional tile that was just laid down (otherwise we' have to completely redraw the board the board info if tilecolor =white_tile additionaltilecolor white else additionaltilecolor black additionaltilexadditionaltiley translateboardtopixelcoord(additionaltile[ ]additionaltile[ ] pygame draw circle(displaysurfadditionaltilecolor(additionaltilexadditionaltiley)int(spacesize pygame display update( for rgbvalues in range( int(animationspeed )) if rgbvalues rgbvalues elif rgbvalues rgbvalues if tilecolor =white_tile color tuple([rgbvalues rgbvalues goes from to elif tilecolor =black_tile color tuple([ rgbvalues rgbvalues goes from to for xy in tilestoflip centerxcentery translateboardtopixelcoord(xy pygame draw circle(displaysurfcolor(centerxcentery)int(spacesize pygame display update( mainclock tick(fps checkforquit( def drawboard(board) draw background of board displaysurf blit(bgimagebgimage get_rect() draw grid lines of the board for in range(boardwidth )email questions to the authoral@inventwithpython com