Console Tic-Tac-Toe with Minimax AI
A two-player and single-player Tic-Tac-Toe game played in the terminal, where the single-player mode uses a minimax algorithm for an unbeatable computer opponent. Learners practice 2D array representation, recursive algorithms, and game-loop structuring in C.
- Estimate
- ~7.5h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
stdio.h
Project roadmap
- 01
Build the board representation and rendering
~1hRepresent the 3x3 board as a char array and write a function to print it clearly to the terminal.
- 02
Implement move input and validation
~1.5hRead player moves, validate they target an empty cell within bounds, and update the board.
- 03
Add win/draw detection
~1.5hWrite a function that checks all rows, columns, and diagonals for a winning line or detects a full-board draw.
- 04
Implement the minimax algorithm
~2.5hWrite a recursive minimax function that scores board states to pick the optimal computer move.
- 05
Wire up the game loop and modes
~1hCombine everything into a loop supporting two-player and vs-computer modes with a replay prompt.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack