A simple command-line Tic-Tac-Toe game built in C++ with AI difficulty levels.
- Play against an AI with Easy and Medium difficulty.
- Smart AI that blocks winning moves.
- User-friendly interface in the console.
Make sure you have a C++ compiler installed:
# For Linux/macOS
sudo apt install g++ # Ubuntu/Debian
brew install gcc # macOS
# For Windows
Download MinGW from https://www.mingw-w64.org/Clone the repository:
git clone https://github.com/huyhoang171106/tic-tac-toe.git
cd tic-tac-toe/srcCompile the program:
g++ main.cpp -o tic_tac_toe
./tic_tac_toeOr use Makefile (if included):
make
./tic_tac_toe- Run the game.
- Choose your marker (
XorO). - Select difficulty level (Easy/Medium).
- Enter a number (1-9) to place your marker.
- Win by making a row, column, or diagonal.
tic-tac-toe/
│── src/
│ ├── main.cpp # The main game logic
│── README.md # Game documentation
│── .gitignore # Ignore compiled files
│── LICENSE # Open-source license
│── Makefile # Compilation script (if needed)
This project is licensed under the MIT License.
Pull requests are welcome. Open an issue for suggestions!