Skip to content

Khushi256/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Tic Tac Toe Game (C++)

This is a simple Tic Tac Toe game written in C++ that allows two players to enter their names and play alternately using standard 'X' and 'O' markers. The game declares the winner or notifies a draw based on the moves.

๐ŸŽฎ Features

  • Two-player mode with custom name input
  • Visual 3x3 board display after each move
  • Detects win, loss, or draw conditions
  • Input validation for already-occupied cells
  • Simple terminal-based interface

๐Ÿ› ๏ธ Technologies Used

  • Language: C++
  • Compilation: g++ or any standard C++ compiler
  • Platform: Command-line (Terminal)

๐Ÿš€ How to Run

1. Clone the Repository

git clone https://github.com/Khushi256/tic-tac-toe.git
cd tic-tac-toe

2. Compile the Code

Use any C++ compiler, for example g++:

g++ tic_tac_toe -o tic_tac_toe

3. Run the Game

 ./tic_tac_toe

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ’ป Example Run

  Enter name of the first player:
  Alice
  Enter name of the second player:
  Bob
  Alice will play first!!
  Bob will play next!!
  
       |      |    
    1  |  2   |  3 
  _____|______|_____
       |      |    
    4  |  5   |  6 
  _____|______|_____
       |      |    
    7  |  8   |  9 
       |      |    
  
  Alice Enter your choice:
  5
  
  ...
  
  Bob WINS!!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages