Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <unistd.h>
- using namespace std;
- //Settings VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
- bool DoublePlay = false;
- bool SkipTutorial = false;
- bool SkipHelp = false;
- string PlayerOneMark = "X ";
- string PlayerTwoMark = "O "; //You can change these if you want to, but just make a space after
- string PlayerThreeMark = "Y "; //it.
- //Settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- //Normal stuff below
- bool AlreadyAsked = false;
- bool HasSomebodyWon = false;
- bool LegalMove = false;
- bool IsStillPossibleToWin = false;
- bool HasGivenCredit = false;
- int WhichPlayerWon;
- int WhosTurn = 1;
- int HowManyTurns = 0;
- string Answer;
- string CurrentPlayerMark;
- //Tutorial stuff below
- bool TutComplete = false;
- bool PlayerTurn = false;
- int TWPW;
- string TutorialMark;
- //Extra stuff below
- bool HelpTold = false;
- vector<string> TutorialSpots {
- "1", //0
- "2", //1
- "3", //2
- "4", //3
- "5", //4
- "6", //5
- "7", //6
- "8", //7
- "9" //8
- };
- /*
- 1 | 2 | 3
- -----------
- 4 | 5 | 6
- -----------
- 7 | 8 | 9
- */
- void TutorialBoard() {
- for (int Repeats = 40; Repeats >= 0; Repeats--) {
- cout << "\n";
- }
- cout << " " << TutorialSpots[0] << " | " << TutorialSpots[1] << " | " << TutorialSpots[2] << "\n";
- cout << "----------\n";
- cout << " " << TutorialSpots[3] << " | " << TutorialSpots[4] << " | " << TutorialSpots[5] << "\n";
- cout << "----------\n";
- cout << " " << TutorialSpots[6] << " | " << TutorialSpots[7] << " | " << TutorialSpots[8] << "\n";
- }
- bool TutorialCheck() {
- TWPW = 0;
- if (TutorialSpots[0] == TutorialSpots[1] && TutorialSpots[1] == TutorialSpots[2] || TutorialSpots[0] == TutorialSpots[3] && TutorialSpots[3] == TutorialSpots[6] || TutorialSpots[0] == TutorialSpots[4] && TutorialSpots[4] == TutorialSpots[8]) {
- if (PlayerTurn) {
- TWPW = 1;
- } else {
- TWPW = 2;
- }
- return true;
- } else if (TutorialSpots[1] == TutorialSpots[4] && TutorialSpots[4] == TutorialSpots[7]) {
- if (PlayerTurn) {
- TWPW = 1;
- } else {
- TWPW = 2;
- }
- return true;
- } else if (TutorialSpots[2] == TutorialSpots[4] && TutorialSpots[4] == TutorialSpots[6] || TutorialSpots[2] == TutorialSpots[5] && TutorialSpots[5] == TutorialSpots[8]) {
- if (PlayerTurn) {
- TWPW = 1;
- } else {
- TWPW = 2;
- }
- return true;
- } else if (TutorialSpots[3] == TutorialSpots[4] && TutorialSpots[4] == TutorialSpots[5]) {
- if (PlayerTurn) {
- TWPW = 1;
- } else {
- TWPW = 2;
- }
- return true;
- } else if (TutorialSpots[6] == TutorialSpots[7] && TutorialSpots[7] == TutorialSpots[8]) {
- if (PlayerTurn) {
- TWPW = 1;
- } else {
- TWPW = 2;
- }
- return true;
- }
- IsStillPossibleToWin = false;
- if (TutorialSpots[0] == "1" || TutorialSpots[1] == "2" || TutorialSpots[2] == "3" || TutorialSpots[3] == "4" || TutorialSpots[4] == "5" || TutorialSpots[5] == "6" || TutorialSpots[6] == "7" || TutorialSpots[7] == "8" || TutorialSpots[8] == "9") {
- IsStillPossibleToWin = true;
- }
- if (TWPW == 0 && IsStillPossibleToWin == false) {
- TWPW = 5;
- return true;
- }
- }
- void TutorialTurn() {
- if (PlayerTurn) {
- PlayerTurn = false;
- TutorialMark = "Y";
- } else {
- PlayerTurn = true;
- TutorialMark = "X";
- }
- LegalMove = false;
- do {
- if (PlayerTurn) {
- cout << "X ";
- } else {
- cout << "Y ";
- }
- cin >> Answer;
- if (Answer == "1" && TutorialSpots[0] == "1") {
- TutorialSpots[0] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "2" && TutorialSpots[1] == "2") {
- TutorialSpots[1] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "3" && TutorialSpots[2] == "3") {
- TutorialSpots[2] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "4" && TutorialSpots[3] == "4") {
- TutorialSpots[3] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "5" && TutorialSpots[4] == "5") {
- TutorialSpots[4] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "6" && TutorialSpots[5] == "6") {
- TutorialSpots[5] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "7" && TutorialSpots[6] == "7") {
- TutorialSpots[6] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "8" && TutorialSpots[7] == "8") {
- TutorialSpots[7] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "9" && TutorialSpots[8] == "9") {
- TutorialSpots[8] = TutorialMark;
- LegalMove = true;
- }
- } while (LegalMove == false);
- if (DoublePlay) {
- cout << "Double mark!\n";
- LegalMove = false;
- do {
- if (PlayerTurn) {
- cout << "X ";
- } else {
- cout << "Y ";
- }
- cin >> Answer;
- if (Answer == "1" && TutorialSpots[0] == "1") {
- TutorialSpots[0] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "2" && TutorialSpots[1] == "2") {
- TutorialSpots[1] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "3" && TutorialSpots[2] == "3") {
- TutorialSpots[2] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "4" && TutorialSpots[3] == "4") {
- TutorialSpots[3] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "5" && TutorialSpots[4] == "5") {
- TutorialSpots[4] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "6" && TutorialSpots[5] == "6") {
- TutorialSpots[5] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "7" && TutorialSpots[6] == "7") {
- TutorialSpots[6] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "8" && TutorialSpots[7] == "8") {
- TutorialSpots[7] = TutorialMark;
- LegalMove = true;
- } else if (Answer == "9" && TutorialSpots[8] == "9") {
- TutorialSpots[8] = TutorialMark;
- LegalMove = true;
- }
- } while (LegalMove == false);
- }
- }
- vector<string> Spots {
- "1a", //0
- "2a", //1
- "3a", //2
- "4a", //3
- "5a", //4
- "6a", //5
- "7a", //6
- "8a", //7
- "9a", //8
- "10a", //9
- "1b", //10
- "2b", //11
- "3b", //12
- "4b", //13
- "5b", //14
- "6b", //15
- "7b", //16
- "8b", //17
- "9b", //18
- "10b", //19
- "1c", //20
- "2c", //21
- "3c", //22
- "4c", //23
- "5c", //24
- "6c", //25
- "7c", //26
- "8c", //27
- "9c", //28
- "10c" //29
- };
- void Board() {
- for (int Repeats = 50; Repeats >= 0; Repeats--) {
- cout << "\n";
- }
- cout << Spots[0] << " | " << Spots[1] << " | " << Spots[2] << " | " << Spots[3] << " | " << Spots[4];
- cout << " | " << Spots[5] << " | " << Spots[6] << " | " << Spots[7] << " | " << Spots[8];
- cout << " | " << Spots[9] << "\n" << "-------------------------------------------------\n" << Spots[10] << " | " << Spots[11] << " | " << Spots[12];
- cout << " | " << Spots[13] << " | " << Spots[14] << " | " << Spots[15] << " | " << Spots[16] << " | ";
- cout << Spots[17] << " | " << Spots[18] << " | " << Spots[19] << "\n" << "-------------------------------------------------\n";
- cout << Spots[20] << " | " << Spots[21] << " | " << Spots[22] << " | " << Spots[23] << " | " << Spots[24] << " | " << Spots[25];
- cout << " | " << Spots[26] << " | " << Spots[27] << " | " << Spots[28] << " | " << Spots[29] << "\n";
- }
- bool PlayAgain() {
- do {
- cout << "Play again?\n";
- cout << "# ";
- cin >> Answer;
- } while (Answer != "Yes" && Answer != "yes" && Answer != "no" && Answer != "No" && Answer != "Y" && Answer != "y" && Answer != "N" && Answer != "n");
- if (Answer == "Yes" || Answer == "yes" || Answer == "Y" || Answer == "y") {
- return true;
- } else {
- return false;
- }
- }
- bool Checker() {
- if (Spots[0] == Spots[10] && Spots[10] == Spots[20] || Spots[0] == Spots[1] && Spots[1] == Spots[2] || Spots[0] == Spots[11] && Spots[11] == Spots[22]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[1] == Spots[2] && Spots[2] == Spots[3] || Spots[1] == Spots[11] && Spots[11] == Spots[21] || Spots[1] == Spots[12] && Spots[12] == Spots[23]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[2] == Spots[12] && Spots[12] == Spots[22] || Spots[2] == Spots[13] && Spots[13] == Spots[24] || Spots[3] == Spots[12] && Spots[12] == Spots[21] || Spots[2] == Spots[3] && Spots[3] == Spots[4]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[3] == Spots[4] && Spots[4] == Spots[5] || Spots[3] == Spots[13] && Spots[13] == Spots[23] || Spots[3] == Spots[14] && Spots[14] == Spots[25]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[4] == Spots[5] && Spots[5] == Spots[6] || Spots[4] == Spots[14] && Spots[14] == Spots[24] || Spots[4] == Spots[15] && Spots[15] == Spots[26] || Spots[4] == Spots[13] && Spots[13] == Spots[22]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[5] == Spots[6] && Spots[6] == Spots[7] || Spots[5] == Spots[15] && Spots[15] == Spots[25] || Spots[5] == Spots[16] && Spots[16] == Spots[27] || Spots[5] == Spots[14] && Spots[14] == Spots[23]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[6] == Spots[7] && Spots[7] == Spots[8] || Spots[6] == Spots[16] && Spots[16] == Spots[26] || Spots[6] == Spots[17] && Spots[17] == Spots[28] || Spots[6] == Spots[15] && Spots[15] == Spots[24]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[7] == Spots[8] && Spots[8] == Spots[9] || Spots[7] == Spots[17] && Spots[17] == Spots[27] || Spots[7] == Spots[18] && Spots[18] == Spots[29] || Spots[7] == Spots[16] && Spots[16] == Spots[25]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[10] == Spots[11] && Spots[11] == Spots[12] || Spots[11] == Spots[12] && Spots[12] == Spots[13] || Spots[12] == Spots[13] && Spots[13] == Spots[14] || Spots[13] == Spots[14] && Spots[14] == Spots[15]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[15] == Spots[16] && Spots[16] == Spots[17] || Spots[17] == Spots[18] && Spots[18] == Spots[19]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[20] == Spots[21] && Spots[21] == Spots[22] || Spots[21] == Spots[22] && Spots[22] == Spots[23] || Spots[22] == Spots[23] && Spots[23] == Spots[24] || Spots[23] == Spots[24] && Spots[24] == Spots[25]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- } else if (Spots[25] == Spots[26] && Spots[26] == Spots[27] || Spots[26] == Spots[27] && Spots[27] == Spots[28] || Spots[27] == Spots[28] && Spots[28] == Spots[29]) {
- WhichPlayerWon = WhosTurn;
- HasSomebodyWon = true;
- }
- IsStillPossibleToWin = false;
- if (Spots[0] == "1a" || Spots[1] == "2a" || Spots[2] == "3a" || Spots[3] == "4a" || Spots[4] == "5a" || Spots[5] == "6a" || Spots[6] == "7a" || Spots[7] == "8a" || Spots[8] == "9a" || Spots[9] == "10a" ||
- Spots[10] == "1b" || Spots[11] == "2b" || Spots[12] == "3b" || Spots[13] == "4b" || Spots[14] == "5b" || Spots[15] == "6b" || Spots[16] == "7b" || Spots[17] == "8b" || Spots[18] == "9b" || Spots[19] == "10b" ||
- Spots[20] == "1c" || Spots[21] == "2c" || Spots[22] == "3c" || Spots[23] == "4c" || Spots[24] == "5c" || Spots[25] == "6c" || Spots[26] == "7c" || Spots[27] == "8c" || Spots[28] == "9c" || Spots[29] == "10c") {
- IsStillPossibleToWin = true;
- }
- if (IsStillPossibleToWin == false) {
- WhichPlayerWon = 5;
- HasSomebodyWon = true;
- }
- }
- void Turn() {
- cout << "Its player " << WhosTurn << "'s turn!\n";
- LegalMove = false;
- do {
- if (WhosTurn == 1) {
- cout << PlayerOneMark << " ";
- CurrentPlayerMark = PlayerOneMark;
- } else if (WhosTurn == 2) {
- cout << PlayerTwoMark << " ";
- CurrentPlayerMark = PlayerTwoMark;
- } else if (WhosTurn == 3) {
- cout << PlayerThreeMark << " ";
- CurrentPlayerMark = PlayerThreeMark;
- }
- cin >> Answer;
- if (Answer == "1a" && Spots[0] == "1a") {
- Spots[0] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "2a" && Spots[1] == "2a") {
- Spots[1] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "3a" && Spots[2] == "3a") {
- Spots[2] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "4a" && Spots[3] == "4a") {
- Spots[3] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "5a" && Spots[4] == "5a") {
- Spots[4] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "6a" && Spots[5] == "6a") {
- Spots[5] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "7a" && Spots[6] == "7a") {
- Spots[6] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "8a" && Spots[7] == "8a") {
- Spots[7] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "9a" && Spots[8] == "9a") {
- Spots[8] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "10a" && Spots[9] == "10a") {
- Spots[9] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "1b" && Spots[10] == "1b") {
- Spots[10] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "2b" && Spots[11] == "2b") {
- Spots[11] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "3b" && Spots[12] == "3b") {
- Spots[12] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "4b" && Spots[13] == "4b") {
- Spots[13] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "5b" && Spots[14] == "5b") {
- Spots[14] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "6b" && Spots[15] == "6b") {
- Spots[15] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "7b" && Spots[16] == "7b") {
- Spots[16] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "8b" && Spots[17] == "8b") {
- Spots[17] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "9b" && Spots[18] == "9b") {
- Spots[18] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "10b" && Spots[19] == "10b") {
- Spots[19] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "1c" && Spots[20] == "1c") {
- Spots[20] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "2c" && Spots[21] == "2c") {
- Spots[21] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "3c" && Spots[22] == "3c") {
- Spots[22] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "4c" && Spots[23] == "4c") {
- Spots[23] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "5c" && Spots[24] == "5c") {
- Spots[24] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "6c" && Spots[25] == "6c") {
- Spots[25] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "7c" && Spots[26] == "7c") {
- Spots[26] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "8c" && Spots[27] == "8c") {
- Spots[27] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "9c" && Spots[28] == "9c") {
- Spots[28] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "10c" && Spots[29] == "10c") {
- Spots[29] = CurrentPlayerMark;
- LegalMove = true;
- }
- } while (LegalMove == false);
- if (DoublePlay) {
- do {
- Board();
- if (WhosTurn == 1) {
- cout << PlayerOneMark << " ";
- CurrentPlayerMark = PlayerOneMark;
- } else if (WhosTurn == 2) {
- cout << PlayerTwoMark << " ";
- CurrentPlayerMark = PlayerTwoMark;
- } else if (WhosTurn == 3) {
- cout << PlayerThreeMark << " ";
- CurrentPlayerMark = PlayerThreeMark;
- }
- cin >> Answer;
- if (Answer == "1a" && Spots[0] == "1a") {
- Spots[0] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "2a" && Spots[1] == "2a") {
- Spots[1] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "3a" && Spots[2] == "3a") {
- Spots[2] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "4a" && Spots[3] == "4a") {
- Spots[3] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "5a" && Spots[4] == "5a") {
- Spots[4] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "6a" && Spots[5] == "6a") {
- Spots[5] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "7a" && Spots[6] == "7a") {
- Spots[6] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "8a" && Spots[7] == "8a") {
- Spots[7] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "9a" && Spots[8] == "9a") {
- Spots[8] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "10a" && Spots[9] == "10a") {
- Spots[9] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "1b" && Spots[10] == "1b") {
- Spots[10] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "2b" && Spots[11] == "2b") {
- Spots[11] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "3b" && Spots[12] == "3b") {
- Spots[12] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "4b" && Spots[13] == "4b") {
- Spots[13] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "5b" && Spots[14] == "5b") {
- Spots[14] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "6b" && Spots[15] == "6b") {
- Spots[15] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "7b" && Spots[16] == "7b") {
- Spots[16] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "8b" && Spots[17] == "8b") {
- Spots[17] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "9b" && Spots[18] == "9b") {
- Spots[18] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "10b" && Spots[19] == "10b") {
- Spots[19] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "1c" && Spots[20] == "1c") {
- Spots[20] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "2c" && Spots[21] == "2c") {
- Spots[21] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "3c" && Spots[22] == "3c") {
- Spots[22] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "4c" && Spots[23] == "4c") {
- Spots[23] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "5c" && Spots[24] == "5c") {
- Spots[24] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "6c" && Spots[25] == "6c") {
- Spots[25] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "7c" && Spots[26] == "7c") {
- Spots[26] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "8c" && Spots[27] == "8c") {
- Spots[27] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "9c" && Spots[28] == "9c") {
- Spots[28] = CurrentPlayerMark;
- LegalMove = true;
- } else if (Answer == "10c" && Spots[29] == "10c") {
- Spots[29] = CurrentPlayerMark;
- LegalMove = true;
- }
- } while (LegalMove == false);
- }
- }
- int main() {
- if (not SkipHelp && not HelpTold) {
- HelpTold = true;
- cout << "*You can change the settings at the top of the code, please dont change anything else though! (double play lets you go twice and skip tutorial is literally its name.*\n";
- sleep(5);
- }
- if (SkipTutorial == false && not TutComplete) {
- TutorialBoard();
- do {
- TutorialTurn();
- TutorialCheck();
- TutorialBoard();
- } while (TutComplete == false || IsStillPossibleToWin == false);
- }
- Board();
- WhosTurn = 3; //Defaults it to 1
- do {
- if (WhosTurn == 1) {
- WhosTurn = 2;
- } else if (WhosTurn == 2) {
- WhosTurn = 3;
- } else if (WhosTurn == 3) {
- WhosTurn = 1;
- }
- Turn();
- Checker();
- Board();
- } while (HasSomebodyWon == false);
- if (WhichPlayerWon == 1) {
- cout << "Player one won!\n";
- } else if (WhichPlayerWon == 2) {
- cout << "Player two won!\n";
- } else if (WhichPlayerWon == 3) {
- cout << "Player three won!\n";
- } else {
- cout << "Its a tie!\n";
- }
- if (PlayAgain() == true) {
- HasSomebodyWon = false;
- Spots[0] = "1a";
- Spots[1] = "2a";
- Spots[2] = "3a";
- Spots[3] = "4a";
- Spots[4] = "5a";
- Spots[5] = "6a";
- Spots[6] = "7a";
- Spots[7] = "8a";
- Spots[8] = "9a";
- Spots[9] = "10a";
- Spots[10] = "1b";
- Spots[11] = "2b";
- Spots[12] = "3b";
- Spots[13] = "4b";
- Spots[14] = "5b";
- Spots[15] = "6b";
- Spots[16] = "7b";
- Spots[17] = "8b";
- Spots[18] = "9b";
- Spots[19] = "10b";
- Spots[20] = "1c";
- Spots[21] = "2c";
- Spots[22] = "3c";
- Spots[23] = "4c";
- Spots[24] = "5c";
- Spots[25] = "6c";
- Spots[26] = "7c";
- Spots[27] = "8c";
- Spots[28] = "9c";
- Spots[29] = "10c";
- main();
- }
- }
- /*
- 1a | 2a | 3a | 4a | 5a | 6a | 7a | 8a | 9a | 10a
- -------------------------------------------------
- 1b | 2b | 3b | 4b | 5b | 6b | 7b | 8b | 9b | 10b
- -------------------------------------------------
- 1c | 2c | 3c | 4c | 5c | 6c | 7c | 8c | 9c | 10c
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement