-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTIC-TAC-TOE.cpp
19 lines (18 loc) · 5.98 KB
/
TIC-TAC-TOE.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
using namespace std; std::string /**/ board[3] [3]; /**/void/*space*/ drawBoard() { cout <</*this_is_tic_t*/ /**/ /*CCCCCCCCCCC*/ /*No this is not cheating,this is j-*/ /*OOOO*/ /*EEEEEEEEEEEEEEEEEEEE*/
"+-+-+-+"/**/ << endl; cout << "|" << board[1][1]<< /**/"|"<<board/**/ [2][1] << "|" << /*ac_toe_code_that_*/ /*AA*/ /*CCCCCCCCC*/ /*ust thinking,I'm not adding all of*/ /*OO OO*/ /*EEEEEEEEEEEEEEEEEEEE*/
board[3][1] <</**/ "|" << endl; cout<< "+-+-+-+" << /**/endl; cout << "|" << board[1][2]/*spells_t*/ /*A A*/ /*CCCCCCC*/ /*the ai just for this.I know I'm a */ /*OO OO*/ /*EEE*/
<< "|" << board[2][2] << "|"<</*cool*/ board[3][2]<< "|"<</**/ endl; cout << "+-+-+-+"<< endl;/*ic_*/ /*A A*/ /*CCCCC*/ /*lazy piece of crap TTTTTTTTTTTTTTT*/ /*OO OO*/ /*EEE*/
cout << "|" <<board[1][3] <<"|"<< board[2] [3] << "|"<< board[3] [3]<</*TTT*/ "|" /**/ /*EEE*/
<< endl;/**/ cout <<"+-+-" << "+-+" <</**/endl;} void /**/ allocate () { for ( int row= 1;row<4;
row++) {for (int col = 1; col/*C*/ < 4 ; col++) {/**/ board [ col ] [row] = "*" ; } }}void /*EEE*/ /******** codeBox *******/
turnA(){/**/ cout << "Play" <</*C*/ "er A's turn!" << /**/endl; cout <<"E" << "n" <<"ter t"<<"wo" << " coordi" << "nat" <</*EEEEEEEEEEEEEEEEEE*/ /**/ "es (1-3):"; /**/
loop:int/**/ input1 = 0; int/*C*/ input2 = 0;cin >> input1 >> input2 ; if ( board [input2][input1 ] /*TTTTTT*/ /**/ /**/ /*EEEEEEEEEEEEEEEEEEEE*/ /**/ /**/
!= "*")/**/ {drawBoard(); cout/**/ <<"You can't " <<"place yo" << "u" <<"r " << "sy" <<"mbol "<<"th" <<"ere!" << endl ;cout /*EEE*/ /**/ /**/
<</**/"Try" <<" again: "; goto/**/ loop; } else { board[input2][input1] = "X"/*C*/; }/**/} void turnB() /**/ /*EEE*/ /**/ /**/
{ cout << "Player B's t" << "ur" <<"n!"/**/<< endl; cout<</**/"Enter two c" << "oo" << "rdinate" << "s " <</*E*/ /**/"(1-3):"; loop:int/**/
input1 = 0; int input2 = 0;/**/cin >> input1 >> input2 ; if(board [input2 ] [input1] != "*") { /**/ /*EEE*/ /**/ /**/
drawBoard(); cout << "You" <<" can't pl" <<"ace your" <<" symb" <<"ol " <</*CCCCC*/ "there!" << endl ;cout <</*E*/ /**/"Try again:";goto /**/
loop;} else{ board[input2] [input1/*-*/ ] = "O"; } } void/**/ /*AAAA*/ gameLoop/*CC*/ (){ for( int loop = 1; loop/// /**YOU DID NOT SEE THIS**/
< 10;loop++) { if (loop% 2 != 0){ turnA(); }/**/ else { turnB() ;/*AA*/} drawBoard/*CCC*/ ();}cout << "D"<< "RAW!" /*EEEEEEEEEEEEEEEEEEEE*/
<<endl;}/**/ int main()/**/ /**/{allocate(); drawBoard(); gameLoop /*A*/(); return /*CCCC*/0;} /*TTTTTTTT*/ /*OOOOOOOOOOO*/ /*EEEEEEEEEEEEEEEEEEEE*/