This is a Tic Tac Toe game written in C with GUI using GTK+3. The game offers 3 game modes: Player vs Player, Player vs Computer and Player vs Computer (Impossible Mode). The game is played on a 3x3 board. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner. GTK3 library provides a clear graphical interface and allows to play the game with a mouse.
In this mode, two players play against each other. The first player is X and the second player is O. The players take turns placing their marks on the board until one of them wins or the board is full.
In this mode, the player plays against the computer. The player is X and the computer is O. The player can choose who starts the game. The player and computer take turns placing their marks on the board following the same rules as in the Player vs Player mode. It is worth noting that the computer is using a simplified version of the minimax algorithm to determine the best move, which allows for faulty moves.
This mode is identical to the Player vs Computer mode, except that the computer is using a full implementation of the minimax algorithm to determine the best move. The computer will never lose in this mode. Don't believe me? Try it yourself!
brew install gtk+3 && brew install pkg-config
- Navigate to the project directory:
cd path/to/Tic-Tac-Toe-Game-C-GUI
- Build the game:
make all
- Run the game:
./build/tic-tac-toe
-
Choose the game mode.
-
Open the game window and play!
You can find comments to the code in .h files.