terminal-tictactoe
Overview
This Tic Tac Toe game is implemented in C++ and allows two players to take turns marking spaces on a 3x3 grid. The game determines a winner if a player successfully aligns three of their symbols horizontally, vertically, or diagonally.
Prerequisites
To compile and run the game, ensure you have the following installed on your system:
- g++ (GNU Compiler Collection): A C++ compiler to build the project.
Compilation and Execution
Follow these steps to compile and run the program:
-
Open a terminal and navigate to the directory containing
tictactoe.cpp. -
Compile the code with the following command:
g++ -std=c++11 tictactoe.cpp -o tictactoeThis will create an executable file named
tictactoe. -
Run the program using:
./tictactoe
Gameplay Instructions
-
At the start, the game displays an empty 3x3 board and a guide for the input keys.
-
Players take turns entering their moves. Input keys correspond to the grid positions:
L1,M1,R1for the top row.L2,M2,R2for the middle row.L3,M3,R3for the bottom row.
-
Example of valid input:
M2will place the current player's marker in the middle cell of the board.
-
The game checks for a win or draw after each move. If a player wins, the game announces the winner and exits.
-
If a player attempts to mark an already occupied cell, they will be prompted to choose another position.
-
Invalid input (e.g.,
X1,middle) will prompt the player to enter a valid move.
Troubleshooting
- If you encounter issues running the game, ensure
g++is installed and the file paths are correct. - If the program fails to compile, ensure you are using at least C++11 by specifying
-std=c++11during compilation.
License
This project is distributed under the MIT License.
Contributions
Contributions are welcome! Feel free to fork the repository and submit pull requests.
Credits
- Developer: Joaquin Gottlebe
- Built With: C++