This is an enhanced Tic-Tac-Toe game implemented in C with improved visuals and user experience. It allows two players to play in the terminal with a beautiful colored interface, robust input validation, and ergonomic gameplay features.
โ
Two-player mode (Player 1: 'X', Player 2: 'O')
โ
Beautiful colored interface with ANSI colors (Cyan X, Magenta O)
โ
Enhanced board design using Unicode box-drawing characters
โ
Robust input validation (invalid positions, occupied cells, non-numeric input)
โ
Clear screen between moves for better visibility
โ
Play again option - no need to restart the program
โ
Checks for horizontal, vertical, and diagonal wins
โ
Detects a draw if the board is full
โ
User-friendly prompts and error messages with emoji indicators
- tttgame.c โ Main program file containing the game logic
git clone https://github.com/katoki-dev/tic-tac-game.git
cd tic-tac-game gcc tttgame.c -o tic_tac_toe ./tic_tac_toe - Players take turns entering a number (1-9) to place their mark on the board.
- Position 1 is top-left, Position 9 is bottom-right.
- The game validates your input and shows clear error messages for invalid moves.
- After each game, you can choose to play again or exit.
- Colorful interface: X appears in cyan, O appears in magenta, available positions in yellow
- Box-drawing characters: Professional-looking grid with Unicode borders
- Clear screen: Fresh view after each move for better focus
- Emoji indicators: Visual feedback for game states (๐ฎ game, ๐ game over, ๐ winner, โ errors)
- Input validation: Prevents invalid moves (out of range, occupied cells, non-numeric input)
- Error messages: Clear feedback when something goes wrong
- Play again: Continue playing without restarting the program
- Fixed position bug: Corrected indexing for positions 1-9
The game checks for a win based on:
- Horizontal Line โ
- Vertical Line โ
- Diagonal Line โ
๐ก Feel free to contribute or modify the code! Let me know if you have any suggestions. ๐