Skip to content

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe (C++)

Simple Tic Tac Toe Game In C++

A terminal-based, two-player tic-tac-toe game built in C++, focused on practicing core language fundamentals — functions, 2D vectors, pass-by-reference, control flow, and a complete game loop with input validation and win/draw detection.

Tic Tac Toe gameplay

How to build

g++ -std=c++17 -Wall -Wextra -Werror src/main.cpp -o tictactoe

How to run

./tictactoe

Usage

When prompted for a row or column, use the coordinates below (0-2):

 (0,0) | (0,1) | (0,2)
-------+-------+-------
 (1,0) | (1,1) | (1,2)
-------+-------+-------
 (2,0) | (2,1) | (2,2)

Example game:

Hello, tic-tac-toe!
Player 1 choose between X or O: 
X
Player 1 makes a move: 
Enter row:0
Enter column:0
 X |   |  
---+---+---
   |   |  
---+---+---
   |   |  
Player 2 makes a move:
Enter row:1
Enter column:0
 X |   |  
---+---+---
 O |   |  
---+---+---
   |   |  
Player 1 makes a move: 
Enter row:0
Enter column:1
 X | X |  
---+---+---
 O |   |  
---+---+---
   |   |  
Player 2 makes a move:
Enter row:1
Enter column:1
 X | X |  
---+---+---
 O | O |  
---+---+---
   |   |  
Player 1 makes a move: 
Enter row:0
Enter column:2
 X | X | X 
---+---+---
 O | O |  
---+---+---
   |   |  
Player1 Wins!

Status

Complete

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages