Advertisement
UnlimitedSupply

3 Player TicTacToe

Jun 19th, 2022
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 24.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <unistd.h>
  4. using namespace std;
  5.  
  6. //Settings VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  7. bool DoublePlay = false;
  8. bool SkipTutorial = false;
  9. bool SkipHelp = false;
  10. string PlayerOneMark = "X ";
  11. string PlayerTwoMark = "O ";   //You can change these if you want to, but just make a space after
  12. string PlayerThreeMark = "Y "; //it.
  13. //Settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  14.  
  15. //Normal stuff below
  16. bool AlreadyAsked = false;
  17. bool HasSomebodyWon = false;
  18. bool LegalMove = false;
  19. bool IsStillPossibleToWin = false;
  20. bool HasGivenCredit = false;
  21. int WhichPlayerWon;
  22. int WhosTurn = 1;
  23. int HowManyTurns = 0;
  24. string Answer;
  25. string CurrentPlayerMark;
  26.  
  27. //Tutorial stuff below
  28. bool TutComplete = false;
  29. bool PlayerTurn = false;
  30. int TWPW;
  31. string TutorialMark;
  32.  
  33. //Extra stuff below
  34. bool HelpTold = false;
  35.  
  36. vector<string> TutorialSpots {
  37.     "1", //0
  38.     "2", //1
  39.     "3", //2
  40.     "4", //3
  41.     "5", //4
  42.     "6", //5
  43.     "7", //6
  44.     "8", //7
  45.     "9"  //8
  46. };
  47. /*
  48.  1 | 2 | 3
  49. -----------
  50.  4 | 5 | 6
  51. -----------
  52.  7 | 8 | 9
  53. */
  54. void TutorialBoard() {
  55.     for (int Repeats = 40; Repeats >= 0; Repeats--) {
  56.         cout << "\n";
  57.     }
  58.     cout << " " << TutorialSpots[0] << " | " << TutorialSpots[1] << " | " << TutorialSpots[2] << "\n";
  59.     cout << "----------\n";
  60.     cout << " " << TutorialSpots[3] << " | " << TutorialSpots[4] << " | " << TutorialSpots[5] << "\n";
  61.     cout << "----------\n";
  62.     cout << " " << TutorialSpots[6] << " | " << TutorialSpots[7] << " | " << TutorialSpots[8] << "\n";
  63. }
  64.  
  65. bool TutorialCheck() {
  66.     TWPW = 0;
  67.     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]) {
  68.         if (PlayerTurn) {
  69.             TWPW = 1;
  70.         } else {
  71.             TWPW = 2;
  72.         }
  73.         return true;
  74.     } else if (TutorialSpots[1] == TutorialSpots[4] && TutorialSpots[4] == TutorialSpots[7]) {
  75.         if (PlayerTurn) {
  76.             TWPW = 1;
  77.         } else {
  78.             TWPW = 2;
  79.         }
  80.         return true;
  81.     } else if (TutorialSpots[2] == TutorialSpots[4] && TutorialSpots[4] == TutorialSpots[6] || TutorialSpots[2] == TutorialSpots[5] && TutorialSpots[5] == TutorialSpots[8]) {
  82.         if (PlayerTurn) {
  83.             TWPW = 1;
  84.         } else {
  85.             TWPW = 2;
  86.         }
  87.         return true;
  88.     } else if (TutorialSpots[3] == TutorialSpots[4] && TutorialSpots[4] == TutorialSpots[5]) {
  89.         if (PlayerTurn) {
  90.             TWPW = 1;
  91.         } else {
  92.             TWPW = 2;
  93.         }
  94.         return true;
  95.     } else if (TutorialSpots[6] == TutorialSpots[7] && TutorialSpots[7] == TutorialSpots[8]) {
  96.         if (PlayerTurn) {
  97.             TWPW = 1;
  98.         } else {
  99.             TWPW = 2;
  100.         }
  101.         return true;
  102.     }
  103.     IsStillPossibleToWin = false;
  104.     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") {
  105.         IsStillPossibleToWin = true;
  106.     }
  107.     if (TWPW == 0 && IsStillPossibleToWin == false) {
  108.         TWPW = 5;
  109.         return true;
  110.     }
  111. }
  112.  
  113. void TutorialTurn() {
  114.     if (PlayerTurn) {
  115.         PlayerTurn = false;
  116.         TutorialMark = "Y";
  117.     } else {
  118.         PlayerTurn = true;
  119.         TutorialMark = "X";
  120.     }
  121.     LegalMove = false;
  122.     do {
  123.         if (PlayerTurn) {
  124.             cout << "X ";
  125.         } else {
  126.             cout << "Y ";
  127.         }
  128.         cin >> Answer;
  129.         if (Answer == "1" && TutorialSpots[0] == "1") {
  130.             TutorialSpots[0] = TutorialMark;
  131.             LegalMove = true;
  132.         } else if (Answer == "2" && TutorialSpots[1] == "2") {
  133.             TutorialSpots[1] = TutorialMark;
  134.             LegalMove = true;
  135.         } else if (Answer == "3" && TutorialSpots[2] == "3") {
  136.             TutorialSpots[2] = TutorialMark;
  137.             LegalMove = true;
  138.         } else if (Answer == "4" && TutorialSpots[3] == "4") {
  139.             TutorialSpots[3] = TutorialMark;
  140.             LegalMove = true;
  141.         } else if (Answer == "5" && TutorialSpots[4] == "5") {
  142.             TutorialSpots[4] = TutorialMark;
  143.             LegalMove = true;
  144.         } else if (Answer == "6" && TutorialSpots[5] == "6") {
  145.             TutorialSpots[5] = TutorialMark;
  146.             LegalMove = true;
  147.         } else if (Answer == "7" && TutorialSpots[6] == "7") {
  148.             TutorialSpots[6] = TutorialMark;
  149.             LegalMove = true;
  150.         } else if (Answer == "8" && TutorialSpots[7] == "8") {
  151.             TutorialSpots[7] = TutorialMark;
  152.             LegalMove = true;
  153.         } else if (Answer == "9" && TutorialSpots[8] == "9") {
  154.             TutorialSpots[8] = TutorialMark;
  155.             LegalMove = true;
  156.         }
  157.     } while (LegalMove == false);
  158.     if (DoublePlay) {
  159.         cout << "Double mark!\n";
  160.         LegalMove = false;
  161.         do {
  162.             if (PlayerTurn) {
  163.                 cout << "X ";
  164.             } else {
  165.                 cout << "Y ";
  166.             }
  167.             cin >> Answer;
  168.             if (Answer == "1" && TutorialSpots[0] == "1") {
  169.                 TutorialSpots[0] = TutorialMark;
  170.                 LegalMove = true;
  171.             } else if (Answer == "2" && TutorialSpots[1] == "2") {
  172.                 TutorialSpots[1] = TutorialMark;
  173.                 LegalMove = true;
  174.             } else if (Answer == "3" && TutorialSpots[2] == "3") {
  175.                 TutorialSpots[2] = TutorialMark;
  176.                 LegalMove = true;
  177.             } else if (Answer == "4" && TutorialSpots[3] == "4") {
  178.                 TutorialSpots[3] = TutorialMark;
  179.                 LegalMove = true;
  180.             } else if (Answer == "5" && TutorialSpots[4] == "5") {
  181.                 TutorialSpots[4] = TutorialMark;
  182.                 LegalMove = true;
  183.             } else if (Answer == "6" && TutorialSpots[5] == "6") {
  184.                 TutorialSpots[5] = TutorialMark;
  185.                 LegalMove = true;
  186.             } else if (Answer == "7" && TutorialSpots[6] == "7") {
  187.                 TutorialSpots[6] = TutorialMark;
  188.                 LegalMove = true;
  189.             } else if (Answer == "8" && TutorialSpots[7] == "8") {
  190.                 TutorialSpots[7] = TutorialMark;
  191.                 LegalMove = true;
  192.             } else if (Answer == "9" && TutorialSpots[8] == "9") {
  193.                 TutorialSpots[8] = TutorialMark;
  194.                 LegalMove = true;
  195.             }
  196.         } while (LegalMove == false);
  197.     }
  198. }
  199.  
  200. vector<string> Spots {
  201.     "1a", //0
  202.     "2a", //1
  203.     "3a", //2
  204.     "4a", //3
  205.     "5a", //4
  206.     "6a", //5
  207.     "7a", //6
  208.     "8a", //7
  209.     "9a", //8
  210.     "10a", //9
  211.     "1b", //10
  212.     "2b", //11
  213.     "3b", //12
  214.     "4b", //13
  215.     "5b", //14
  216.     "6b", //15
  217.     "7b", //16
  218.     "8b", //17
  219.     "9b", //18
  220.     "10b", //19
  221.     "1c",  //20
  222.     "2c",  //21
  223.     "3c",  //22
  224.     "4c",  //23
  225.     "5c",  //24
  226.     "6c",  //25
  227.     "7c",  //26
  228.     "8c",  //27
  229.     "9c",  //28
  230.     "10c"  //29
  231. };
  232. void Board() {
  233.     for (int Repeats = 50; Repeats >= 0; Repeats--) {
  234.         cout << "\n";
  235.     }
  236.     cout << Spots[0] << " | " << Spots[1] << " | " << Spots[2] << " | " << Spots[3] << " | " << Spots[4];
  237.     cout << " | " << Spots[5] << " | " << Spots[6] << " | " << Spots[7] << " | " << Spots[8];
  238.     cout << " | " << Spots[9] << "\n" << "-------------------------------------------------\n" << Spots[10] << " | " << Spots[11] << " | " << Spots[12];
  239.     cout << " | " << Spots[13] << " | " << Spots[14] << " | " << Spots[15] << " | " << Spots[16] << " | ";
  240.     cout << Spots[17] << " | " << Spots[18] << " | " << Spots[19] << "\n" << "-------------------------------------------------\n";
  241.     cout << Spots[20] << " | " << Spots[21] << " | " << Spots[22] << " | " << Spots[23] << " | " << Spots[24] << " | " << Spots[25];
  242.     cout << " | " << Spots[26] << " | " << Spots[27] << " | " << Spots[28] << " | " << Spots[29] << "\n";
  243.    
  244. }
  245.  
  246. bool PlayAgain() {
  247.     do {
  248.         cout << "Play again?\n";
  249.         cout << "# ";
  250.         cin >> Answer;
  251.     } while (Answer != "Yes" && Answer != "yes" && Answer != "no" && Answer != "No" && Answer != "Y" && Answer != "y" && Answer != "N" && Answer != "n");
  252.     if (Answer == "Yes" || Answer == "yes" || Answer == "Y" || Answer == "y") {
  253.         return true;
  254.     } else {
  255.         return false;
  256.     }
  257. }
  258.  
  259. bool Checker() {
  260.     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]) {
  261.         WhichPlayerWon = WhosTurn;
  262.         HasSomebodyWon = true;
  263.     } 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]) {
  264.         WhichPlayerWon = WhosTurn;
  265.         HasSomebodyWon = true;
  266.     } 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]) {
  267.         WhichPlayerWon = WhosTurn;
  268.         HasSomebodyWon = true;
  269.     } 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]) {
  270.         WhichPlayerWon = WhosTurn;
  271.         HasSomebodyWon = true;
  272.     } 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]) {
  273.         WhichPlayerWon = WhosTurn;
  274.         HasSomebodyWon = true;
  275.     } 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]) {
  276.         WhichPlayerWon = WhosTurn;
  277.         HasSomebodyWon = true;
  278.     } 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]) {
  279.         WhichPlayerWon = WhosTurn;
  280.         HasSomebodyWon = true;
  281.     } 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]) {
  282.         WhichPlayerWon = WhosTurn;
  283.         HasSomebodyWon = true;
  284.     } 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]) {
  285.         WhichPlayerWon = WhosTurn;
  286.         HasSomebodyWon = true;
  287.     } else if (Spots[15] == Spots[16] && Spots[16] == Spots[17] || Spots[17] == Spots[18] && Spots[18] == Spots[19]) {
  288.         WhichPlayerWon = WhosTurn;
  289.         HasSomebodyWon = true;
  290.     } 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]) {
  291.         WhichPlayerWon = WhosTurn;
  292.         HasSomebodyWon = true;
  293.     } 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]) {
  294.         WhichPlayerWon = WhosTurn;
  295.         HasSomebodyWon = true;
  296.     }
  297.     IsStillPossibleToWin = false;
  298.     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" ||
  299.     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" ||
  300.     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") {
  301.         IsStillPossibleToWin = true;
  302.     }
  303.     if (IsStillPossibleToWin == false) {
  304.         WhichPlayerWon = 5;
  305.         HasSomebodyWon = true;
  306.     }
  307. }
  308.  
  309. void Turn() {
  310.     cout << "Its player " << WhosTurn << "'s turn!\n";
  311.     LegalMove = false;
  312.     do {
  313.         if (WhosTurn == 1) {
  314.             cout << PlayerOneMark << " ";
  315.             CurrentPlayerMark = PlayerOneMark;
  316.         } else if (WhosTurn == 2) {
  317.             cout << PlayerTwoMark << " ";
  318.             CurrentPlayerMark = PlayerTwoMark;
  319.         } else if (WhosTurn == 3) {
  320.             cout << PlayerThreeMark << " ";
  321.             CurrentPlayerMark = PlayerThreeMark;
  322.         }
  323.         cin >> Answer;
  324.         if (Answer == "1a" && Spots[0] == "1a") {
  325.             Spots[0] = CurrentPlayerMark;
  326.             LegalMove = true;
  327.         } else if (Answer == "2a" && Spots[1] == "2a") {
  328.             Spots[1] = CurrentPlayerMark;
  329.             LegalMove = true;
  330.         } else if (Answer == "3a" && Spots[2] == "3a") {
  331.             Spots[2] = CurrentPlayerMark;
  332.             LegalMove = true;
  333.         } else if (Answer == "4a" && Spots[3] == "4a") {
  334.             Spots[3] = CurrentPlayerMark;
  335.             LegalMove = true;
  336.         } else if (Answer == "5a" && Spots[4] == "5a") {
  337.             Spots[4] = CurrentPlayerMark;
  338.             LegalMove = true;
  339.         } else if (Answer == "6a" && Spots[5] == "6a") {
  340.             Spots[5] = CurrentPlayerMark;
  341.             LegalMove = true;
  342.         } else if (Answer == "7a" && Spots[6] == "7a") {
  343.             Spots[6] = CurrentPlayerMark;
  344.             LegalMove = true;
  345.         } else if (Answer == "8a" && Spots[7] == "8a") {
  346.             Spots[7] = CurrentPlayerMark;
  347.             LegalMove = true;
  348.         } else if (Answer == "9a" && Spots[8] == "9a") {
  349.             Spots[8] = CurrentPlayerMark;
  350.             LegalMove = true;
  351.         } else if (Answer == "10a" && Spots[9] == "10a") {
  352.             Spots[9] = CurrentPlayerMark;
  353.             LegalMove = true;
  354.         } else if (Answer == "1b" && Spots[10] == "1b") {
  355.             Spots[10] = CurrentPlayerMark;
  356.             LegalMove = true;
  357.         } else if (Answer == "2b" && Spots[11] == "2b") {
  358.             Spots[11] = CurrentPlayerMark;
  359.             LegalMove = true;
  360.         } else if (Answer == "3b" && Spots[12] == "3b") {
  361.             Spots[12] = CurrentPlayerMark;
  362.             LegalMove = true;
  363.         } else if (Answer == "4b" && Spots[13] == "4b") {
  364.             Spots[13] = CurrentPlayerMark;
  365.             LegalMove = true;
  366.         } else if (Answer == "5b" && Spots[14] == "5b") {
  367.             Spots[14] = CurrentPlayerMark;
  368.             LegalMove = true;
  369.         } else if (Answer == "6b" && Spots[15] == "6b") {
  370.             Spots[15] = CurrentPlayerMark;
  371.             LegalMove = true;
  372.         } else if (Answer == "7b" && Spots[16] == "7b") {
  373.             Spots[16] = CurrentPlayerMark;
  374.             LegalMove = true;
  375.         } else if (Answer == "8b" && Spots[17] == "8b") {
  376.             Spots[17] = CurrentPlayerMark;
  377.             LegalMove = true;
  378.         } else if (Answer == "9b" && Spots[18] == "9b") {
  379.             Spots[18] = CurrentPlayerMark;
  380.             LegalMove = true;
  381.         } else if (Answer == "10b" && Spots[19] == "10b") {
  382.             Spots[19] = CurrentPlayerMark;
  383.             LegalMove = true;
  384.         } else if (Answer == "1c" && Spots[20] == "1c") {
  385.             Spots[20] = CurrentPlayerMark;
  386.             LegalMove = true;
  387.         } else if (Answer == "2c" && Spots[21] == "2c") {
  388.             Spots[21] = CurrentPlayerMark;
  389.             LegalMove = true;
  390.         } else if (Answer == "3c" && Spots[22] == "3c") {
  391.             Spots[22] = CurrentPlayerMark;
  392.             LegalMove = true;
  393.         } else if (Answer == "4c" && Spots[23] == "4c") {
  394.             Spots[23] = CurrentPlayerMark;
  395.             LegalMove = true;
  396.         } else if (Answer == "5c" && Spots[24] == "5c") {
  397.             Spots[24] = CurrentPlayerMark;
  398.             LegalMove = true;
  399.         } else if (Answer == "6c" && Spots[25] == "6c") {
  400.             Spots[25] = CurrentPlayerMark;
  401.             LegalMove = true;
  402.         } else if (Answer == "7c" && Spots[26] == "7c") {
  403.             Spots[26] = CurrentPlayerMark;
  404.             LegalMove = true;
  405.         } else if (Answer == "8c" && Spots[27] == "8c") {
  406.             Spots[27] = CurrentPlayerMark;
  407.             LegalMove = true;
  408.         } else if (Answer == "9c" && Spots[28] == "9c") {
  409.             Spots[28] = CurrentPlayerMark;
  410.             LegalMove = true;
  411.         } else if (Answer == "10c" && Spots[29] == "10c") {
  412.             Spots[29] = CurrentPlayerMark;
  413.             LegalMove = true;
  414.         }
  415.     } while (LegalMove == false);
  416.     if (DoublePlay) {
  417.         do {
  418.             Board();
  419.             if (WhosTurn == 1) {
  420.                 cout << PlayerOneMark << " ";
  421.                 CurrentPlayerMark = PlayerOneMark;
  422.             } else if (WhosTurn == 2) {
  423.                 cout << PlayerTwoMark << " ";
  424.                 CurrentPlayerMark = PlayerTwoMark;
  425.             } else if (WhosTurn == 3) {
  426.                 cout << PlayerThreeMark << " ";
  427.                 CurrentPlayerMark = PlayerThreeMark;
  428.             }
  429.             cin >> Answer;
  430.             if (Answer == "1a" && Spots[0] == "1a") {
  431.                 Spots[0] = CurrentPlayerMark;
  432.                 LegalMove = true;
  433.             } else if (Answer == "2a" && Spots[1] == "2a") {
  434.                 Spots[1] = CurrentPlayerMark;
  435.                 LegalMove = true;
  436.             } else if (Answer == "3a" && Spots[2] == "3a") {
  437.                 Spots[2] = CurrentPlayerMark;
  438.                 LegalMove = true;
  439.             } else if (Answer == "4a" && Spots[3] == "4a") {
  440.                 Spots[3] = CurrentPlayerMark;
  441.                 LegalMove = true;
  442.             } else if (Answer == "5a" && Spots[4] == "5a") {
  443.                 Spots[4] = CurrentPlayerMark;
  444.                 LegalMove = true;
  445.             } else if (Answer == "6a" && Spots[5] == "6a") {
  446.                 Spots[5] = CurrentPlayerMark;
  447.                 LegalMove = true;
  448.             } else if (Answer == "7a" && Spots[6] == "7a") {
  449.                 Spots[6] = CurrentPlayerMark;
  450.                 LegalMove = true;
  451.             } else if (Answer == "8a" && Spots[7] == "8a") {
  452.                 Spots[7] = CurrentPlayerMark;
  453.                 LegalMove = true;
  454.             } else if (Answer == "9a" && Spots[8] == "9a") {
  455.                 Spots[8] = CurrentPlayerMark;
  456.                 LegalMove = true;
  457.             } else if (Answer == "10a" && Spots[9] == "10a") {
  458.                 Spots[9] = CurrentPlayerMark;
  459.                 LegalMove = true;
  460.             } else if (Answer == "1b" && Spots[10] == "1b") {
  461.                 Spots[10] = CurrentPlayerMark;
  462.                 LegalMove = true;
  463.             } else if (Answer == "2b" && Spots[11] == "2b") {
  464.                 Spots[11] = CurrentPlayerMark;
  465.                 LegalMove = true;
  466.             } else if (Answer == "3b" && Spots[12] == "3b") {
  467.                 Spots[12] = CurrentPlayerMark;
  468.                 LegalMove = true;
  469.             } else if (Answer == "4b" && Spots[13] == "4b") {
  470.                 Spots[13] = CurrentPlayerMark;
  471.                 LegalMove = true;
  472.             } else if (Answer == "5b" && Spots[14] == "5b") {
  473.                 Spots[14] = CurrentPlayerMark;
  474.                 LegalMove = true;
  475.             } else if (Answer == "6b" && Spots[15] == "6b") {
  476.                 Spots[15] = CurrentPlayerMark;
  477.                 LegalMove = true;
  478.             } else if (Answer == "7b" && Spots[16] == "7b") {
  479.                 Spots[16] = CurrentPlayerMark;
  480.                 LegalMove = true;
  481.             } else if (Answer == "8b" && Spots[17] == "8b") {
  482.                 Spots[17] = CurrentPlayerMark;
  483.                 LegalMove = true;
  484.             } else if (Answer == "9b" && Spots[18] == "9b") {
  485.                 Spots[18] = CurrentPlayerMark;
  486.                 LegalMove = true;
  487.             } else if (Answer == "10b" && Spots[19] == "10b") {
  488.                 Spots[19] = CurrentPlayerMark;
  489.                 LegalMove = true;
  490.             } else if (Answer == "1c" && Spots[20] == "1c") {
  491.                 Spots[20] = CurrentPlayerMark;
  492.                 LegalMove = true;
  493.             } else if (Answer == "2c" && Spots[21] == "2c") {
  494.                 Spots[21] = CurrentPlayerMark;
  495.                 LegalMove = true;
  496.             } else if (Answer == "3c" && Spots[22] == "3c") {
  497.                 Spots[22] = CurrentPlayerMark;
  498.                 LegalMove = true;
  499.             } else if (Answer == "4c" && Spots[23] == "4c") {
  500.                 Spots[23] = CurrentPlayerMark;
  501.                 LegalMove = true;
  502.             } else if (Answer == "5c" && Spots[24] == "5c") {
  503.                 Spots[24] = CurrentPlayerMark;
  504.                 LegalMove = true;
  505.             } else if (Answer == "6c" && Spots[25] == "6c") {
  506.                 Spots[25] = CurrentPlayerMark;
  507.                 LegalMove = true;
  508.             } else if (Answer == "7c" && Spots[26] == "7c") {
  509.                 Spots[26] = CurrentPlayerMark;
  510.                 LegalMove = true;
  511.             } else if (Answer == "8c" && Spots[27] == "8c") {
  512.                 Spots[27] = CurrentPlayerMark;
  513.                 LegalMove = true;
  514.             } else if (Answer == "9c" && Spots[28] == "9c") {
  515.                 Spots[28] = CurrentPlayerMark;
  516.                 LegalMove = true;
  517.             } else if (Answer == "10c" && Spots[29] == "10c") {
  518.                 Spots[29] = CurrentPlayerMark;
  519.                 LegalMove = true;
  520.             }
  521.         } while (LegalMove == false);
  522.     }
  523. }
  524. int main() {
  525.     if (not SkipHelp && not HelpTold) {
  526.         HelpTold = true;
  527.         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";
  528.         sleep(5);
  529.     }
  530.     if (SkipTutorial == false && not TutComplete) {
  531.         TutorialBoard();
  532.         do {
  533.             TutorialTurn();
  534.             TutorialCheck();
  535.             TutorialBoard();
  536.         } while (TutComplete == false || IsStillPossibleToWin == false);
  537.     }
  538.     Board();
  539.     WhosTurn = 3; //Defaults it to 1
  540.     do {
  541.         if (WhosTurn == 1) {
  542.             WhosTurn = 2;
  543.         } else if (WhosTurn == 2) {
  544.             WhosTurn = 3;
  545.         } else if (WhosTurn == 3) {
  546.             WhosTurn = 1;
  547.         }
  548.         Turn();
  549.         Checker();
  550.         Board();
  551.     } while (HasSomebodyWon == false);
  552.     if (WhichPlayerWon == 1) {
  553.         cout << "Player one won!\n";
  554.     } else if (WhichPlayerWon == 2) {
  555.         cout << "Player two won!\n";
  556.     } else if (WhichPlayerWon == 3) {
  557.         cout << "Player three won!\n";
  558.     } else {
  559.         cout << "Its a tie!\n";
  560.     }
  561.     if (PlayAgain() == true) {
  562.         HasSomebodyWon = false;
  563.         Spots[0] = "1a";
  564.         Spots[1] = "2a";
  565.         Spots[2] = "3a";
  566.         Spots[3] = "4a";
  567.         Spots[4] = "5a";
  568.         Spots[5] = "6a";
  569.         Spots[6] = "7a";
  570.         Spots[7] = "8a";
  571.         Spots[8] = "9a";
  572.         Spots[9] = "10a";
  573.         Spots[10] = "1b";
  574.         Spots[11] = "2b";
  575.         Spots[12] = "3b";
  576.         Spots[13] = "4b";
  577.         Spots[14] = "5b";
  578.         Spots[15] = "6b";
  579.         Spots[16] = "7b";
  580.         Spots[17] = "8b";
  581.         Spots[18] = "9b";
  582.         Spots[19] = "10b";
  583.         Spots[20] = "1c";
  584.         Spots[21] = "2c";
  585.         Spots[22] = "3c";
  586.         Spots[23] = "4c";
  587.         Spots[24] = "5c";
  588.         Spots[25] = "6c";
  589.         Spots[26] = "7c";
  590.         Spots[27] = "8c";
  591.         Spots[28] = "9c";
  592.         Spots[29] = "10c";
  593.         main();
  594.     }
  595. }
  596. /*
  597. 1a | 2a | 3a | 4a | 5a | 6a | 7a | 8a | 9a | 10a
  598. -------------------------------------------------
  599. 1b | 2b | 3b | 4b | 5b | 6b | 7b | 8b | 9b | 10b
  600. -------------------------------------------------
  601. 1c | 2c | 3c | 4c | 5c | 6c | 7c | 8c | 9c | 10c
  602. */
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement