Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yousef-sayed-younis/tic-tac-toe-terminal

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.
https://github.com/yousef-sayed-younis/tic-tac-toe-terminal

ai command-line-game cpp game-development single-player terminal-game tic-tac-toe two-player unbeatable-ai

Last synced: 6 days ago
JSON representation

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.

Awesome Lists containing this project

README

        

# Tic Tac Toe - Terminal Version

**Author:** [Yousef-Sayed-Younis](https://github.com/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](https://github.com/Yousef-Sayed-Younis/tic-tac-toe-flutter)

---

## 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](https://github.com/Yousef-Sayed-Younis/tic-tac-toe-flutter)** of this game!