This is a command-line implementation of the classic Tic-Tac-Toe game. The game allows two players to take turns and compete against each other until there is a winner or a tie.
- Play against another human player or a random computer player.
- The game displays the current state of the board after each move.
-
Run the
game.py
file in your terminal using Python 3: -
The game will prompt you to enter moves for each player in the command line.
-
Player X starts the game. When prompted, enter the desired move as a number from 0 to 8, corresponding to the board positions:
-
The game will continue until there is a winner or a tie.
-
Enjoy playing Tic-Tac-Toe!
-
You can customize the game by creating different types of players. Currently, the game supports a Human Player
HumanPlayer
and a Random Computer PlayerRandomComputerPlayer
. -
To create a new player, create a new class that extends the
Player
class and implement theget_move
method. -
In the
play
function ofgame.py
, you can modify the players used for the game.
The repository contains the following files:
gam.py
: The main Python script that implements the Tic-Tac-Toe game logic.player.py
: A module containing the player classes used in the game.README.md
: This file, providing information about the game and instructions.
The game has been implemented using Python 3. No additional libraries or dependencies are required.
Author: Akbarali Nabiev This project is licensed under the MIT License. Feel free to use and modify it according to your needs.