print('( )all'end='' bext fg('cyan' print('( )lub'end='' bext fg('purple' print('( )pade'end='' bext fg('white' print('or quit:' response input(''upper( if response ='quit' print('thanks for playing!' sys exit( if displaymode =color_mode and response in tuple('rgbycp') return tile type number based on the response return {' ' ' ' ' ' ' ' ' ' ' ' }[response if displaymode =shape_mode and response in tuple('htdbcs') return tile type number based on the response return {' ' ' ' ' ': ' ' ' ' ' ' }[response def changetile(tiletypeboardxychartochange=none) """change the color/shape of tile using the recursive flood fill algorithm "" if = and = chartochange board[(xy) if tiletype =chartochange return base casealready is the same tile board[(xy)tiletype if and board[( )=chartochange recursive casechange the left neighbor' tile changetile(tiletypeboardx ychartochange if and board[(xy )=chartochange recursive casechange the top neighbor' tile changetile(tiletypeboardxy chartochange if board_width and board[( )=chartochange recursive casechange the right neighbor' tile changetile(tiletypeboardx ychartochange if board_height and board[(xy )=chartochange recursive casechange the bottom neighbor' tile changetile(tiletypeboardxy chartochange def haswon(board) """return true if the entire board is one color/shape "" tile board[( ) for in range(board_width) for in range(board_height) if board[(xy)!tile return false return true project #