Python: Write a script to play two dimensional Tic-Tac-Toe between two human players who alternate entering their move on the same computer. Use a 5-by-5 two-dimensional array. Each player indicates their moves by entering a pair of numbers representing the row and column indices of the square in which they want to place their mark, either an 'X' or an 'O'. When the first player moves, place an 'X' in the specified square. When the second player moves, place an 'O' in the specified square. Each move must be to an empty square. After each move, determine whether the game has been won and whether it’s a draw. print the total number of moves it takes to have a win or draw. Now modify your script to create a tournament of three Tic-Tac-Toe games and print out which player wins at the end of a tournament.
Python:
Write a script to play two dimensional Tic-Tac-Toe between two human players who alternate entering their move on the same computer. Use a 5-by-5 two-dimensional array. Each player indicates their moves by entering a pair of numbers representing the row and column indices of the square in which they want to place their mark, either an 'X' or an 'O'. When the first player moves, place an 'X' in the specified square. When the second player moves, place an 'O' in the specified square. Each move must be to an empty square. After each move, determine whether the game has been won and whether it’s a draw. print the total number of moves it takes to have a win or draw.
Now modify your script to create a tournament of three Tic-Tac-Toe games and print out which player wins at the end of a tournament.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images









