if nextboardspace in flower_spaces print(turn'landed on flower space and goes again ' input('press enter to continue ' else turn opponent swap turns to the other player def getnewboard() "" returns dictionary that represents the state of the board the keys are strings of the space labelsthe values are x_player o_playeror empty there are also counters for how many tokens are at the home and goal of both players "" board {x_home x_goal o_home o_goal set each space as empty to start for spacelabel in all_spaces board[spacelabelempty return board def displayboard(board) """display the board on the screen "" "clearthe screen by printing many newlinesso the old board isn' visible anymore print('\ xhometokens ('xboard[x_home]ljust( ' xgoaltokens ('xboard[x_goal]ljust( ' ohometokens ('oboard[o_home]ljust( ' ogoaltokens ('oboard[o_goal]ljust( ' add the strings that should populate board_template in order going from left to righttop to bottom spaces [ spaces append(xhometokens spaces append(xgoaltokens for spacelabel in all_spaces spaces append(board[spacelabel] spaces append(ohometokens spaces append(ogoaltokens print(board_template format(*spaces) def getvalidmoves(boardplayerfliptally) validmoves [contains the spaces with tokens that can move if player =x_player opponent o_player track x_track home x_home elif player =o_player opponent x_player track o_track home o_home project #