Question: Problem: Complete the drawBoard method so that it displays the current state of the board, along with the column indices on top of the board,

Problem: Complete the drawBoard method so that it displays the current state of the board, along with the column indices on top of the board, and the row indices to the left of the board. If the content of a given square is 0, an empty space should be displayed. do this with print methods for each line. with uses of symbols like '-' or ' | '

class NumTicTacToe: def __init__(self): ''' Initializes an empty Numerical Tic Tac Toe board. Inputs: none Returns: None ''' self.board = [] # list of lists, where each internal list represents a row self.size = 3 # number of columns and rows of board # populate the empty squares in board with 0 for i in range(self.size): row = [] for j in range(self.size): row.append(0) self.board.append(row) def drawBoard(self): ''' Displays the current state of the board, formatted with column and row indicies shown. Inputs: none Returns: None ''' # print out formatted board # e.g. an empty board should look like this: # 0 1 2 # 0 | | # ----------- # 1 | | # ----------- # 2 | |

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!