if isfull(gameboard) drawboard(gameboard print('game over thanks for playing!' sys exit( def getnewboard() """returns new data structure that represents board it' dictionary with keys of (xytuples and values of the tile at that space the tile is either power-of-two integer or blank the coordinates are laid out as +-+-+-+- +-+-+-+- +-+-+-+- +-+-+-+- +-+-+-+-+"" newboard {contains the board data structure to be returned loop over every possible space and set all the tiles to blank for in range( ) for in range( ) newboard[(xy)blank pick two random spaces for the two starting startingtwosplaced the number of starting spaces picked while startingtwosplaced repeat for duplicate spaces randomspace (random randint( )random randint( ) make sure the randomly selected space isn' already taken if newboard[randomspace=blank newboard[randomspace startingtwosplaced startingtwosplaced return newboard def drawboard(board) """draws the board data structure on the screen "" go through each possible space left to righttop to bottomand create list of what each space' label should be labels [ list of strings for the number/blank for that tile for in range( ) for in range( ) tile board[(xy)get the tile at this space make sure the label is spaces long labelforthistile str(tilecenter( labels append(labelforthistile the {are replaced with the label for that tile project #