Advertisement
KeeganT

Tic Tac Toe Win Cases WIP

Dec 11th, 2017
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. char spots[]{'X','X','X','O','X','O','X','O','O'};
  7.  
  8. void color(int num)
  9. {
  10.     HANDLE color=GetStdHandle(STD_OUTPUT_HANDLE);
  11.     SetConsoleTextAttribute(color, num);
  12. }
  13.  
  14. void boardCase1()
  15. {
  16.         cout<<endl;
  17.         cout<<"\t\t ";
  18.         color(10);
  19.         cout<<spots[0];
  20.         color(7);
  21.         cout<<" | ";
  22.         color(10);
  23.         cout<<spots[1];
  24.         color(7);
  25.         cout<<" | ";
  26.         color(10);
  27.         cout<<spots[2];
  28.         color(7);
  29.         cout<<" "<<endl;
  30.         cout<<"\t\t---+---+---"<<endl;
  31.         cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  32.         cout<<"\t\t---+---+---"<<endl;
  33.         cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  34.         cout<<endl;
  35. }
  36.  
  37. void boardCase2()
  38. {
  39.     cout<<endl;
  40.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  41.     cout<<"\t\t---+---+---"<<endl;
  42.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  43.     cout<<"\t\t---+---+---"<<endl;
  44.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  45.     cout<<endl;
  46. }
  47.  
  48. void boardCase3()
  49. {
  50.     cout<<endl;
  51.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  52.     cout<<"\t\t---+---+---"<<endl;
  53.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  54.     cout<<"\t\t---+---+---"<<endl;
  55.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  56.     cout<<endl;
  57. }
  58.  
  59. void boardCase4()
  60. {
  61.     cout<<endl;
  62.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  63.     cout<<"\t\t---+---+---"<<endl;
  64.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  65.     cout<<"\t\t---+---+---"<<endl;
  66.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  67.     cout<<endl;
  68. }
  69.  
  70. void boardCase5()
  71. {
  72.     cout<<endl;
  73.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  74.     cout<<"\t\t---+---+---"<<endl;
  75.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  76.     cout<<"\t\t---+---+---"<<endl;
  77.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  78.     cout<<endl;
  79. }
  80.  
  81. void boardCase6()
  82. {
  83.     cout<<endl;
  84.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  85.     cout<<"\t\t---+---+---"<<endl;
  86.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  87.     cout<<"\t\t---+---+---"<<endl;
  88.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  89.     cout<<endl;
  90. }
  91.  
  92. void boardCase7()
  93. {
  94.     cout<<endl;
  95.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  96.     cout<<"\t\t---+---+---"<<endl;
  97.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  98.     cout<<"\t\t---+---+---"<<endl;
  99.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  100.     cout<<endl;
  101. }
  102.  
  103. void boardCase8()
  104. {
  105.     cout<<endl;
  106.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  107.     cout<<"\t\t---+---+---"<<endl;
  108.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  109.     cout<<"\t\t---+---+---"<<endl;
  110.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  111.     cout<<endl;
  112. }
  113.  
  114. void boardCase9()
  115. {
  116.     cout<<endl;
  117.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  118.     cout<<"\t\t---+---+---"<<endl;
  119.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  120.     cout<<"\t\t---+---+---"<<endl;
  121.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  122.     cout<<endl;
  123. }
  124.  
  125. void boardCase10()
  126. {
  127.     cout<<endl;
  128.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  129.     cout<<"\t\t---+---+---"<<endl;
  130.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  131.     cout<<"\t\t---+---+---"<<endl;
  132.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  133.     cout<<endl;
  134. }
  135.  
  136. void boardCase11()
  137. {
  138.     cout<<endl;
  139.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  140.     cout<<"\t\t---+---+---"<<endl;
  141.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  142.     cout<<"\t\t---+---+---"<<endl;
  143.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  144.     cout<<endl;
  145. }
  146.  
  147. void boardCase12()
  148. {
  149.     cout<<endl;
  150.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  151.     cout<<"\t\t---+---+---"<<endl;
  152.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  153.     cout<<"\t\t---+---+---"<<endl;
  154.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  155.     cout<<endl;
  156. }
  157.  
  158. void boardCase13()
  159. {
  160.     cout<<endl;
  161.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  162.     cout<<"\t\t---+---+---"<<endl;
  163.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  164.     cout<<"\t\t---+---+---"<<endl;
  165.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  166.     cout<<endl;
  167. }
  168.  
  169. void boardCase14()
  170. {
  171.     cout<<endl;
  172.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  173.     cout<<"\t\t---+---+---"<<endl;
  174.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  175.     cout<<"\t\t---+---+---"<<endl;
  176.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  177.     cout<<endl;
  178. }
  179.  
  180. void boardCase15()
  181. {
  182.     cout<<endl;
  183.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  184.     cout<<"\t\t---+---+---"<<endl;
  185.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  186.     cout<<"\t\t---+---+---"<<endl;
  187.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  188.     cout<<endl;
  189. }
  190.  
  191. void boardCase16()
  192. {
  193.     cout<<endl;
  194.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  195.     cout<<"\t\t---+---+---"<<endl;
  196.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  197.     cout<<"\t\t---+---+---"<<endl;
  198.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  199.     cout<<endl;
  200. }
  201.  
  202. void boardCase17()
  203. {
  204.     cout<<endl;
  205.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  206.     cout<<"\t\t---+---+---"<<endl;
  207.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  208.     cout<<"\t\t---+---+---"<<endl;
  209.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  210.     cout<<endl;
  211. }
  212.  
  213. void boardCase18()
  214. {
  215.     cout<<endl;
  216.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  217.     cout<<"\t\t---+---+---"<<endl;
  218.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  219.     cout<<"\t\t---+---+---"<<endl;
  220.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  221.     cout<<endl;
  222. }
  223.  
  224. void boardCase19()
  225. {
  226.     cout<<endl;
  227.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  228.     cout<<"\t\t---+---+---"<<endl;
  229.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  230.     cout<<"\t\t---+---+---"<<endl;
  231.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  232.     cout<<endl;
  233. }
  234.  
  235. void boardCase20()
  236. {
  237.     cout<<endl;
  238.     cout<<"\t\t "<<spots[0]<<" | "<<spots[1]<<" | "<<spots[2]<<" "<<endl;
  239.     cout<<"\t\t---+---+---"<<endl;
  240.     cout<<"\t\t "<<spots[3]<<" | "<<spots[4]<<" | "<<spots[5]<<" "<<endl;
  241.     cout<<"\t\t---+---+---"<<endl;
  242.     cout<<"\t\t "<<spots[6]<<" | "<<spots[7]<<" | "<<spots[8]<<" "<<endl;
  243.     cout<<endl;
  244. }
  245.  
  246. int main()
  247. {
  248.     boardCase1();
  249.     return 0;
  250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement