Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
/ tic-tac-toe.cc Public archive

Minimalistic Tic-tac-toe implementation for experimenting with C++.

License

Notifications You must be signed in to change notification settings

trueNAHO/tic-tac-toe.cc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe

About

Minimalistic Tic-tac-toe implementation for experimenting with C++.

Functional Features

  • Variable number of players

  • Variable player names

  • Variable field dimensions

  • Start new games without restarting the application

Non-Functional Features

  • C++ best practices

  • Gracefully handle invalid user input

  • Overengineered architecture to explore C++ functionalities

Usage

To compile and run the application with gcc, run:

gcc -o tic-tac-toe src/main.cc
./tic-tac-toe

Demo

Enter number of players: 3

Player #1 enter your name: Player_1
Player #1 enter your sign: A

Player #2 enter your name: Player_2
Player #2 enter your sign: B

Player #3 enter your name: Player_3
Player #3 enter your sign: C

Enter in space seperated formated the number of rows and columns for the board: 2 4
---------
| | | | |
---------
| | | | |
---------

>>> Player_1's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 1 1
---------
|A| | | |
---------
| | | | |
---------

>>> Player_2's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 2 2
---------
|A| | | |
---------
| |B| | |
---------

>>> Player_3's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 3 3
[#1] Invalid rows or columns index. Try again: 0 0
[#2] Invalid rows or columns index. Try again: 1 1
[#3] Field already occupied by 'Player_1'. Try again.
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 2 2
[#4] Field already occupied by 'Player_2'. Try again.
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 21
1
[#5] Invalid rows or columns index. Try again: 2 1
---------
|A| | | |
---------
|C|B| | |
---------

>>> Player_1's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 1 2
---------
|A|A| | |
---------
|C|B| | |
---------

>>> Player_2's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 2 3
---------
|A|A| | |
---------
|C|B|B| |
---------

>>> Player_3's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 2 4
---------
|A|A| | |
---------
|C|B|B|C|
---------

>>> Player_1's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 1 3
---------
|A|A|A| |
---------
|C|B|B|C|
---------

>>> Player_2's turn
Enter rows (1 to 2) and colums (1 to 4) position in space seperated format: 1 4
---------
|A|A|A|B|
---------
|C|B|B|C|
---------

>>> DRAW

Play again? [y/n] n

Contributing

To contribute, please review our contribution guidelines.

License

This project is licensed under GNU GENERAL PUBLIC LICENSE Version 3.

About

Minimalistic Tic-tac-toe implementation for experimenting with C++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages