A text-based Cimplementation of the classic Tic-Tac-Toe game developed in C++.
- Playable on a 3x3 grid.
- Randomly selects the first player (X or O).
- Detect wins, draws, and invalid moves.
- Option to play again after a game ends.
- Clean and simple text-based interface.
- A C++ compiler (e.g.,
clang++
org++
). make
build tool.
- Clone the repository:
git clone https://github.com/giansimone/tic-tac-toe-cpp.git
- Navigate the project directory:
cd tic-tac-toe-cpp
- Build the project:
make
- To build the project in debug mode:
make debug
- To build the project in release mode:
make release
- To clean the build files:
make clean
After building, run the game using:
./bin/tictactoe
- The game starts with an empty grid.
- The first player is randomly chosen.
- Players take turns entering the row and column numbers where they want to place their mark.
- The board positions are numbered as follows:
1 | 2 | 3 --+---+-- 4 | 5 | 6 --+---+-- 7 | 8 | 9
- The game continues until there is a winner or the game ends in a draw.
- The game announces the result and asks if you want to play again.
- Enter 'y' or 'n' to continue or exit the game.
This project is licensed under the MIT License. See the LICENSE file for details.