Skip to content

A simple command-line implementation of the classic Tic Tac Toe game written in C++

Notifications You must be signed in to change notification settings

timothyportnoff/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

C++ Tic Tac Toe Game

This is a simple command-line implementation of the classic Tic Tac Toe game written in C++. The program allows two players to take turns marking X and O on a 3x3 grid until one of them wins or the game ends in a draw.

How to Play

  1. Run the program in a C++ compiler or IDE.
  2. The game will display an empty 3x3 grid, with cells designated by numbers 1-9.
  3. Player X always goes first and will be prompted to enter the cell number of their move.
  4. Player X's move will be marked as X on the grid.
  5. Player O will be prompted to enter their move.
  6. Player O's move will be marked as O on the grid.
  7. Steps 3-6 will repeat until a player wins or the game ends in a draw.
  8. The game will display the winner and exit.

Game Rules

  • Players take turns marking X and O on the grid.
  • The objective is to get three of your marks in a row, column, or diagonal.
  • The game ends when one player wins or the grid is filled without a winner (draw).

File Structure

The program consists of the following files:

  • main.cpp: Contains the main logic, game loop, and our array of board data.

Dependencies

This program has no external dependencies. It is written in standard C++ and should work with any modern C++ compiler.

Getting Started

To run the program, follow these steps:

  1. Clone the repository or download the source code files.
  2. Compile main.cc using a C++ compiler (e.g., g++).
  3. Execute the compiled binary to start the game.

Contributing

Contributions are welcome! If you have any suggestions or improvements, feel free to submit a pull request.

About

A simple command-line implementation of the classic Tic Tac Toe game written in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages