Question: IN PYTHON Write two functions to implement part of a tic-tac-toe game: printBoard: Display a tic-tac-toe board and fullRow: Determine if there is a row
IN PYTHON
Write two functions to implement part of a tic-tac-toe game:
printBoard: Display a tic-tac-toe board
and
fullRow: Determine if there is a row filled with a specific character
Look at the template given + the I/O tests to see what needs to be done.
Note: These functions assume that you might have a tic-tac-toe game that is other than 3x3. The dimension of the board is the third parameter.
# DEFINE YOUR FUNCTIONS (NOT INCLUDING MAIN) IN THIS SECTION
# END OF FUNCTION DEFINITIONS
# MAIN PART OF THE PROGRAM def main(): # YOUR CODE BEGINS HERE print("Here is the board:") tmp = "" while tmp != "STOP": tmp = input() if tmp != "STOP": board = tmp.split(',') printBoard(board) print("Does 'X' have a full row?", fullRow(board, 'X', math.sqrt(len(board)))) print("Does 'O' have a full row?", fullRow(board, 'O', math.sqrt(len(board))))
# INCLUDE THE FOLLOWING 2 LINES, BUT NOTHING ELSE BETWEEN HERE if __name__ == "__main__": main() # AND HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
