Skip to content

A C++ implementation of Tic Tac Toe with AI and two-player modes. Playable entirely in the terminal. A simple, interactive game for practicing algorithms and terminal-based programming.

Notifications You must be signed in to change notification settings

Yousef-Sayed-Younis/tic-tac-toe-terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Tic Tac Toe - Terminal Version

Author: Yousef-Sayed-Younis

Welcome to the C++ Terminal Version of the classic Tic Tac Toe game! This project allows you to enjoy the game in the terminal, either against a computer AI or another player.

For a modern and Flutter-based version of this game with a beautiful UI, check out the repository here:
👉 Tic Tac Toe Flutter Version


Features

  • Play against another player or the computer.
  • Intelligent computer moves for challenging gameplay.
  • Fully interactive terminal interface.

Gameplay

The game begins by asking the player to choose between playing against another player or the computer.
The board layout is displayed, and players take turns to make their moves.

  • Board Layout
    The board positions are numbered as follows:
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
  • Game Outcome
    • The winner is announced if a player manages to align their symbols in a row, column, or diagonal.
    • The game ends in a draw if all positions are filled without a winner.

How to Run

  1. Clone the repository:
    git clone https://github.com/Yousef-Sayed-Younis/tic_tac-toe_terminal.git
    
  2. Navigate to the project directory:
    cd tic_tac-toe-terminal
    
  3. Compile the code:
    g++ main.cpp -o tic_tac_toe
    
  4. Run the executable:
    ./tic_tac_toe
    

Example Gameplay

Starting the game:

Welcome to Tic Tac Toe!
Play against Computer? (y/n): y
Choose X or O: X

Game Board:

| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |

Players take turns by entering the number corresponding to their move.


Contributions

Feel free to contribute by opening issues or submitting pull requests to improve the gameplay or code.


For a visually appealing and feature-rich experience, check out the Flutter Version of this game!

About

A C++ implementation of Tic Tac Toe with AI and two-player modes. Playable entirely in the terminal. A simple, interactive game for practicing algorithms and terminal-based programming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages