bext clear( print('''flooderby al sweigart al@inventwithpython com set the upper left color/shapewhich fills in all the adjacent squares of that color/shape try to make the entire board the same color/shape ''' print('do you want to play in colorblind modey/ ' response input('' if response upper(startswith(' ') displaymode shape_mode else displaymode color_mode gameboard getnewboard( movesleft moves_per_game while truemain game loop displayboard(gameboarddisplaymode print('moves left:'movesleft playermove askforplayermove(displaymode changetile(playermovegameboard movesleft - if haswon(gameboard) displayboard(gameboarddisplaymode print('you have won!' break elif movesleft = displayboard(gameboarddisplaymode print('you have run out of moves!' break def getnewboard() """return dictionary of new flood it board "" keys are (xytuplesvalues are the tile at that position board { create random colors for the board for in range(board_width) for in range(board_height) board[(xy)random choice(tile_types make several tiles the same as their neighbor this creates groups of the same color/shape for in range(board_width board_height) random randint( board_width random randint( board_height board[( )board[(xy) return board project #