This is a simple console-based TikTakToe game implemented in C. The player competes against the computer in a 3x3 grid.
-
Start the Game: Run the program. You will be prompted to enter your moves.
-
Player Move: Enter the row and column numbers (1-3) to place your 'X' on the board.
-
Computer Move: The computer will place an 'O' on the board in a random empty position.
-
Winning Condition: The first player to align three of their symbols (either 'X' or 'O') horizontally, vertically, or diagonally wins the game.
-
Tie Condition: If all spaces are filled and no player has won, the game ends in a tie.
-
resetBoard(): Initializes or resets the game board.
-
printBoard(): Displays the current state of the game board.
-
checkFreeSpaces(): Counts and returns the number of free spaces left on the board.
-
playerMove(): Prompts the player to enter their move.
-
computerMove(): Randomly places a computer move on the board.
-
checkWinner(): Checks the board to determine if there's a winner. printWinner(char winner): Displays the result of the game based on the winner.
-
To check whether MinGW is recognized by your system, use the following command:
gcc -v
-
use the play button in the top right corner to run and debug the code.
-
To compile the game, use the following command:
gcc -o TikTakToe TikTakToe.c
To run the compiled program:
./TikTakToe
If you encounter any issues setting up MinGW on Windows, refer to this guide: How to run a C program in Visual Studio Code
Standard C library: