A classic Tic Tac Toe game implemented using the Qt framework. This application allows two players to play against each other on a 3x3 grid. The game features a simple and intuitive interface, with visual feedback for player moves and win conditions.
- Two-Player Gameplay: Play against a friend on the same device.
- Win Detection: Automatically detects when a player wins.
- Reset Game: Start a new game at any time with the "New Game" button.
- Visual Feedback: Displays player icons (X and O) and highlights the current player's turn.
- Simple Interface: Easy-to-use and visually appealing design.
Game in progress with Player 1 (X) and Player 2 (O).
Game over with a win condition for Player 1 (X).
To run the Tic Tac Toe game, follow these steps:
-
Ensure Qt is installed:
- Download and install the Qt framework from https://www.qt.io/download.
-
Clone the repository:
git clone https://github.com/M1keEm/TicTacToe.git
-
Navigate to the project directory:
cd TicTacToe
-
Open the project in Qt Creator: Launch Qt Creator and open the CMakeLists.txt or .pro file (if available).
-
Build and run the project: Click the "Run" button in Qt Creator to compile and launch the game.
- Start the Game:
- Launch the application to begin a new game.
- Player Turns:
- Player 1 is X, and Player 2 is O.
- Click on any empty cell to place your symbol.
- Winning the game
- The first player to get three of their symbols in a row (horizontally, vertically, or diagonally) wins.
- New Game
- Click the "New Game" button to reset the board and start a new match.
The game logic is implemented in the MainWindow class. Key functions include:
-
clicked(): Handles button clicks and updates the game state.
-
newGame(): Resets the game board and clears player moves.
-
isWin(): Checks for a win condition by evaluating the game board.
The game board is represented by an array (data_tab) where:
-
0 represents an empty cell.
-
1 represents Player 1 (X).
-
2 represents Player 2 (O).
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeatureName
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeatureName
). - Open a pull request.
Please ensure your code follows the existing style and includes appropriate documentation.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or suggestions, feel free to reach out:
- MikeEm - My Github
- Project Link - Repository