This is a simple command-line implementation of the popular game Tic-Tac-Toe written in Python. It allows two players to play the game on the same computer.
1.Clone or download the repository to your computer.
-
Open the terminal and navigate to the project directory.
-
Run the game by executing the command python 2-players-tic-tac-toe.py
-
The game board will be displayed on the screen, and it will be empty at the start of the game.
-
Player 1 will be prompted to make their move by entering a number between 1 and 9, where each number corresponds to a space on the board.
-
After player 1 makes their move, the board will be updated and displayed again.
-
Player 2 will then be prompted to make their move, following the same process as player 1.
-
The game will continue until either a player gets three of their symbols in a row, horizontally, vertically, or diagonally or the board is filled and no one wins the game. The game will be a draw in this case.
-
If a player tries to place their symbol on a space that is already taken, the player will be prompted to choose again.
The first player to get three of their symbols in a row wins the game.
If the grid is completely filled, and no player has achieved three symbols in a row, the game is a draw.
To restart the game, you can just run the script again.
Python 3
This is a simple implementation of Tic-Tac-Toe game, Feel free to fork and make changes to the code to improve the game.