Table of Contents
Minimalistic Tic-tac-toe implementation for experimenting with C++.
-
Variable number of players
-
Variable player names
-
Variable field dimensions
-
Start new games without restarting the application
To compile and run the application with gcc, run:
gcc -o tic-tac-toe src/main.cc
./tic-tac-toe
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
To contribute, please review our contribution guidelines.
This project is licensed under GNU GENERAL PUBLIC LICENSE Version 3.