Question: Using the Python code provided below, write the statements of the following functions; printBoard(board): Function to print the TIC-TAC-TOE board checkRow(row,player): Function to check the

Using the Python code provided below, write the statements of the following functions;

printBoard(board): Function to print the TIC-TAC-TOE board

checkRow(row,player): Function to check the elements in the row of the current play. Returns True if all the elements of the studied row are equal to the player's symbol.

checkColumn(col,player): Function to check the elements in the column of the current play. Returns True if all the elements of the studied column are equal to the player's symbol

checkDiag(row,col,player): Function to check the elements in the diagonal of the current play (only if the current position has to consider the diagonals). Returns True if all of the elements in the studied diagonal are equal to the player's symbol

Note: allowed to change the template (write a comment explaining each change to the original code).

 Using the Python code provided below, write the statements of thefollowing functions; printBoard(board): Function to print the TIC-TAC-TOE board checkRow(row,player): Function to

board = [[,-, for i 1n range (3)] for i 1n range (3)] def printBoard (board): # Function to print the board def checkRow (row, player) # Function t check the elements in the row of the current play. Returns True if all the elements of the studied row e equal to the pleyer's symbol def checkColumn(col,player): # unction to check the elements in the column of the currenc play. Returns True if all the elements of the studied column are equal to the player's symbol def checkDiag (row, col,player # Eunction to check the elements in the diagonal of the current play (only if the current position has to consider the diagonals) . Returns True if all of the elements def winGame (posx, posY,player if checkRow (poax,player) True: elir checkColumn (posY,player) True: elif checkDiag (posX, posY,player)True: else: return 1 retuzn recurn 1 return 0 def makePlay (posx, posY,player): if board [posx] [pos elae: return -1 # invalid option board [poeX] [post] player if winGame (posX, posY,player) -1: return 1 # game ends else: return 0 # game continues Dlay 0 printBoard (board) while play 9: f play 2-0

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!