1: Novice
2: Intermediate
3: Expert
Now if I did everything correct you should not be able to beat the game in expert.
I swore I had a bug last night but could not find it this morning so I may have fixed it on accident (how nice would that be)
It was a good experience for using two dimensional arrays and I might see if I can integrate this into a graphical version
I would love some suggestions on how I could of make it cleaner, shorter or better
I know there's got to be I use a lot of duplicate code that I'm sure I could have done away with but then that's the point in posting your work so it can be nitpicked away and ideas on how to make it better.
I have a question in using the while's as is there a unspoken rule on how to check a bool because I was confusing myself a couple times because a while loop works when a statement is true but I have some that said to run when something is false so I would have to look at it for a minute to think what would kill it. I know I could use a != so the question was more for curiosity
I also have the <windows.h> header in there but its only to clear the screen if using something other than windows just delete the windows header and the 2 ("cls") in the program it will run fine just not as clean a look
other than that I have it in 3 files only for readability you can put the two function calls on top with the rest and just make 1 big file
- Code: Select all
//main
#include <iostream>
#include <windows.h>//only used for two ("cls")
#include <ctime>
#include <cmath>
using namespace std;
bool space_check(char place[5][5], int row, int collum);
bool win_check(char game[5][5]);
bool draw_check(char game[5][5], char toe);
void computerAI(char place[5][5]);
bool ai_play(char place[5][5], char tic, char tac, char toe);
bool ai_play_to_win(char place[5][5], char tac, char toe);
int main()
{
srand((unsigned)time(NULL));
short chance;//for intermediate
short win_check_start = 1;//just put to cut time checking
short draw_check_start = 1;//same
short corner;//for the first move
bool computer_wins = false;
bool first_move = true;//get a key spot
bool intermediate = false;
bool expert = false;
bool ai_pass;//for loop
bool check;
bool win = false;// for loop
bool draw = false;// for loop
bool place_check = true;//check for empty spot
char tic = 'X';//only put if decide to give choice of X's and O's
char tac = 'O';
char toe = ' ';//checks for empty space
char board[5] [5] =
{
{' ', '|', ' ', '|', ' '},
{'-', '-', '-', '-', '-'},
{' ', '|', ' ', '|', ' '},
{'-', '-', '-', '-', '-'},
{' ', '|', ' ', '|', ' '}
};
cout<< "Welcome to yet another game of\n\n\n\t\t\tTIC TAC TOE\n\n";
short level;
while ((cout<< "1:\tNovice\n2:\tIntermediate\n3:\tExpert\n\n") && (!(cin>> level)) || level > 3 || level < 1)
{
cout<< "Please enter a number\n\n";
cin.clear();
cin.ignore((streamsize)pow((float)2, (int)(sizeof(int) * 8 - 1)) - 1, '\n');
}
cin.ignore((streamsize)pow((float)2, (int)(sizeof(int) * 8 - 1)) - 1, '\n');
if (level == 2)// no need for 1 there default to false already
{
intermediate = true;
}
if (level == 3)
{
expert = true;
}
while(win == false && draw == false)
{
system ("cls");//one of two <windows.h> file used one more at the end of main
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
cout<< board[i] [j] ;
}
cout<< "\n";
}
do //while place check == false
{
short choice;
while ((cout<< "Enter 1-9\n") && (!(cin>> choice)) || choice > 9 || choice < 1)
{
cout<< "Please enter a number 1 - 9 no more no less\n\n";
cin.clear();
cin.ignore((streamsize)pow((float)2, (int)(sizeof(int) * 8 - 1)) - 1, '\n');
}
cin.ignore((streamsize)pow((float)2, (int)(sizeof(int) * 8 - 1)) - 1, '\n');//extra measures
if (choice == 1)
{
check = space_check(board, 0, 0);
if (check == true)
{
board[0][0] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 2)
{
check = space_check(board, 0, 2);
if (check == true)
{
board[0][2] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 3)
{
check = space_check(board, 0, 4);
if (check == true)
{
board[0][4] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 4)
{
check = space_check(board, 2, 0);
if (check == true)
{
board[2][0] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 5)
{
check = space_check(board, 2, 2);
if (check == true)
{
board[2][2] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 6)
{
check = space_check(board, 2, 4);
if (check == true)
{
board[2][4] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 7)
{
check = space_check(board, 4, 0);
if (check == true)
{
board[4][0] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 8)
{
check = space_check(board, 4, 2);
if (check == true)
{
board[4][2] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
else if (choice == 9)
{
check = space_check(board, 4, 4);
if (check == true)
{
board[4][4] = tic;
if (win_check_start >= 3)
win = win_check(board);
if (win == true)break;
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
place_check = true;
}
else
{
cout<< "Sorry that place is taken already choose another\n";
place_check = false;
}
}
//after else if ladder
if (expert == true || intermediate == true)
{
if (intermediate == true)
{
chance = rand() % 100 + 1;
if (chance < 20) //means a 20% chance of not getting center or corner on first move
{
first_move = false;
}
}
if (first_move == true)
{
first_move = false;
ai_pass = true;
if (board[2][2] == toe)
{
board[2][2] = tac;
}
else
{
corner = rand() % 4 + 1;//center is best corners second best
if (corner == 1)
{
board[0][0] = tac;
}
else if (corner == 2)
{
board[0][4] = tac;
}
else if (corner == 3)
{
board[4][0] = tac;
}
else if (corner == 4)
{
board[4][4] = tac;
}
}
}//end of first move if
else
{
if (intermediate == true)
{
chance = rand() % 100 + 1;
if (chance < 20)//20% chance of being a random move otherwise its just expert
{
ai_pass = false;
}
else
{
ai_pass = ai_play_to_win(board, tac, toe);
if (win_check_start >= 3)//not realy necessary just saves a couple nano seconds
win = win_check(board);
if (win == true) {computer_wins = true; break;}
ai_pass = ai_play(board, tic, tac, toe);
if (win_check_start >= 3)//same
win = win_check(board);
if (win == true) {computer_wins = true; break;}
if (draw_check_start >= 5)//same
draw = draw_check(board, toe);
if (draw == true)break;
}
}
if (expert == true)
{
ai_pass = ai_play_to_win(board, tac, toe);
if (win_check_start >= 3)
win = win_check(board);
if (win == true) {computer_wins = true; break;}
ai_pass = ai_play(board, tic, tac, toe);
if (win_check_start >= 3)
win = win_check(board);
if (win == true) {computer_wins = true; break;}
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
}
}
}//end of level if
else
{
ai_pass = false;
}
//////////////////////////////////////////////////////
while (ai_pass == false)//this is where novice goes
{
int ai = rand() % 9 + 1;
if (ai == 1)
{
ai_pass = space_check(board, 0, 0);
if (ai_pass == true)
{
board[0][0] = tac;
}
}
else if (ai == 2)
{
ai_pass = space_check(board, 0, 2);
if (ai_pass == true)
{
board[0][2] = tac;
}
}
else if (ai == 3)
{
ai_pass = space_check(board, 0, 4);
if (ai_pass == true)
{
board[0][4] = tac;
}
}
else if (ai == 4)
{
ai_pass = space_check(board, 2, 0);
if (ai_pass == true)
{
board[2][0] = tac;
}
}
else if (ai == 5)
{
ai_pass = space_check(board, 2, 2);
if (ai_pass == true)
{
board[2][2] = tac;
}
}
else if (ai == 6)
{
ai_pass = space_check(board, 2, 4);
if (ai_pass == true)
{
board[2][4] = tac;
}
}
else if (ai == 7)
{
ai_pass = space_check(board, 4, 0);
if (ai_pass == true)
{
board[4][0] = tac;
}
}
else if (ai == 8)
{
ai_pass = space_check(board, 4, 2);
if (ai_pass == true)
{
board[4][2] = tac;
}
}
else if (ai == 9)
{
ai_pass = space_check(board, 4, 4);
if (ai_pass == true)
{
board[4][4] = tac;
}
}
if (win_check_start >= 3)
win = win_check(board);
if (win == true) {computer_wins = true; break;}
if (draw_check_start >= 5)
draw = draw_check(board, toe);
if (draw == true)break;
}//AI while
win_check_start += 1;
draw_check_start += 1;
}while (place_check == false);//do...while
}//while win draw false
system ("cls");//the other <windows.h> file in use
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)//spits out the board after a win or draw
{
cout<< board[i] [j] ;
}
cout<< "\n";
}
if (win == true && computer_wins == true)
{
cout<< "\n\n\n\t\t\tHA HA The Computer Kicked Your Butt\n\n\t\t\tGAME OVER\n\n\n\n";
}
else if (win == true)
{
cout<< "\n\n\n\n\t\t\tYOU WIN\n\n\n";
}
else
{
cout<< "\n\n\n\n\t\t\tDRAW\n\n\n\n\n";
}
}
bool space_check(char place[5][5], int row, int collum)
{
if (place[row][collum] == 'X' || place[row][collum] == 'O')
{
return false;
}
else
{
return true;
}
}
bool win_check(char game[5][5])
{
if (game[0][0] == 'X' && game[2][0] == 'X' && game[4][0] == 'X' || //top across
game[2][0] == 'X' && game[2][2] == 'X' && game[2][4] == 'X' || //middle across
game[4][0] == 'X' && game[4][2] == 'X' && game[4][4] == 'X' || //bottom across
game[0][0] == 'X' && game[0][2] == 'X' && game[0][4] == 'X' || //first down
game[0][2] == 'X' && game[2][2] == 'X' && game[4][2] == 'X' || //middle down
game[0][4] == 'X' && game[2][4] == 'X' && game[4][4] == 'X' || //last down
game[0][0] == 'X' && game[2][2] == 'X' && game[4][4] == 'X' || //top diaganal
game[0][4] == 'X' && game[2][2] == 'X' && game[4][0] == 'X' ||//bottom diaganal
game[0][0] == 'O' && game[2][0] == 'O' && game[4][0] == 'O' || //top across
game[2][0] == 'O' && game[2][2] == 'O' && game[2][4] == 'O' || //middle across
game[4][0] == 'O' && game[4][2] == 'O' && game[4][4] == 'O' || //bottom across
game[0][0] == 'O' && game[0][2] == 'O' && game[0][4] == 'O' || //first down
game[0][2] == 'O' && game[2][2] == 'O' && game[4][2] == 'O' || //middle down
game[0][4] == 'O' && game[2][4] == 'O' && game[4][4] == 'O' || //last down
game[0][0] == 'O' && game[2][2] == 'O' && game[4][4] == 'O' || //top diaganal
game[0][4] == 'O' && game[2][2] == 'O' && game[4][0] == 'O') //bottom diaganal
{
return true;
}
else
{
return false;
}
}
bool draw_check(char game[5][5], char toe)
{
short blank_test;
blank_test = 0;
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
if (game[i][j] == toe)
{
blank_test += 1;
}
}
}
if (blank_test == 0)
{
return true;
}
else
{
return false;
}
}
- Code: Select all
//ai.cpp
bool ai_play_to_win(char place[5][5], char tac, char toe)
{
bool move_pass = false;
///////////////////////////////FIRST ROW ACROSS/////////////////////////
if (place[0][0] == tac && place[0][2] == tac)//across check
{
if (place[0][4] == toe)
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][0] == tac && place[0][4] == tac)//across check
{
if (place[0][2] == toe)
{
place[0][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][2] == tac && place[0][4] == tac)//across check
{
if (place[0][0] == toe)
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
}
//////////////////////////////////////SECOND ROW ACROSS//////////////////////////////
if (place[2][0] == tac && place[2][2] == tac)//across check
{
if (place[2][4] == toe)
{
place[2][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][0] == tac && place[2][4] == tac)//across check
{
if (place[2][2] == toe)
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tac && place[2][4] == tac)//across check
{
if (place[2][0] == toe)
{
place[2][0] = tac;
move_pass = true;
return move_pass;
}
}
/////////////////////////////THIRD ROW ACROSS///////////////////////////////////////////
if (place[4][0] == tac && place[4][2] == tac)//across check
{
if (place[4][4] == toe)
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[4][0] == tac && place[4][4] == tac)//across check
{
if (place[4][2] == toe)
{
place[4][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[4][2] == tac && place[4][4] == tac)//across check
{
if (place[4][0] == toe)
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
////////////////////////FIRST ROW DOWN//////////////////////////////////////////////////////////////
if (place[0][0] == tac && place[2][0] == tac)//down check
{
if (place[4][0] == toe)
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][0] == tac && place[4][0] == tac)//down check
{
if (place[2][0] == toe)
{
place[2][0] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][0] == tac && place[4][0] == tac)//down check
{
if (place[0][0] == toe)
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
}
//////////////////////////////SECOND ROW DOWN///////////////////////////
if (place[0][2] == tac && place[2][2] == tac)//down check
{
if (place[4][2] == toe)
{
place[4][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][2] == tac && place[4][2] == tac)//down check
{
if (place[2][2] == toe)
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tac && place[4][2] == tac)//down check
{
if (place[0][2] == toe)
{
place[0][2] = tac;
move_pass = true;
return move_pass;
}
}
//////////////////////////////////THIRD ROW DOWN/////////////////////////
if (place[0][4] == tac && place[2][4] == tac)//down check
{
if (place[4][4] == toe)
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][4] == tac && place[4][4] == tac)//down check
{
if (place[2][4] == toe)
{
place[2][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][4] == tac && place[4][4] == tac)//down check
{
if (place[0][4] == toe)
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
}
/////////////////////////////TOP DIAGANAL////////////////////////////////
if (place[0][0] == tac && place[2][2] == tac)//diaganal check
{
if (place[4][4] == toe)
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][0] == tac && place[4][4] == tac)//diaganal check
{
if (place[2][2] == toe)
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tac && place[4][4] == tac)//diaganal check
{
if (place[0][0] == toe)
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
}
///////////////////////////////BOTTOM DIAGANAL///////////////////////////////////
if (place[4][0] == tac && place[2][2] == tac)//diaganal check
{
if (place[0][4] == toe)
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[4][0] == tac && place[0][4] == tac)//diaganal check
{
if (place[2][2] == toe)
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tac && place[0][4] == tac)//diaganal check
{
if (place[4][0] == toe)
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
if (move_pass == false)
{
return false;
}
}
- Code: Select all
//ai2.cpp
bool ai_play(char place[5][5], char tic, char tac, char toe)
{
bool move_pass = false;
///////////////////////////////FIRST ROW ACROSS/////////////////////////
if (place[0][0] == tic && place[0][2] == tic)//across check
{
if (place[0][4] == tic || place[0][4] == tac);//move on
else
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][0] == tic && place[0][4] == tic)//across check
{
if (place[0][2] == tic || place[0][2] == tac);//move on
else
{
place[0][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][2] == tic && place[0][4] == tic)//across check
{
if (place[0][0] == tic || place[0][0] == tac);//move on
else
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
}
//////////////////////////////////////SECOND ROW ACROSS//////////////////////////////
if (place[2][0] == tic && place[2][2] == tic)//across check
{
if (place[2][4] == tic || place[2][4] == tac);//move on
else
{
place[2][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][0] == tic && place[2][4] == tic)//across check
{
if (place[2][2] == tic || place[2][2] == tac);//move on
else
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tic && place[2][4] == tic)//across check
{
if (place[2][0] == tic || place[2][0] == tac);//move on
else
{
place[2][0] = tac;
move_pass = true;
return move_pass;
}
}
/////////////////////////////THIRD ROW ACROSS///////////////////////////////////////////
if (place[4][0] == tic && place[4][2] == tic)//across check
{
if (place[4][4] == tic || place[4][4] == tac);//move on
else
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[4][0] == tic && place[4][4] == tic)//across check
{
if (place[4][2] == tic || place[4][2] == tac);//move on
else
{
place[4][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[4][2] == tic && place[4][4] == tic)//across check
{
if (place[4][0] == tic || place[4][0] == tac);//move on
else
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
////////////////////////FIRST ROW DOWN//////////////////////////////////////////////////////////////
if (place[0][0] == tic && place[2][0] == tic)//down check
{
if (place[4][0] == tic || place[4][0] == tac);//move on
else
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][0] == tic && place[4][0] == tic)//down check
{
if (place[2][0] == tic || place[2][0] == tac);//move on
else
{
place[2][0] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][0] == tic && place[4][0] == tic)//down check
{
if (place[0][0] == tic || place[0][0] == tac);//move on
else
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
}
//////////////////////////////SECOND ROW DOWN///////////////////////////
if (place[0][2] == tic && place[2][2] == tic)//down check
{
if (place[4][2] == tic || place[4][2] == tac);//move on
else
{
place[4][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][2] == tic && place[4][2] == tic)//down check
{
if (place[2][2] == tic || place[2][2] == tac);//move on
else
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tic && place[4][2] == tic)//down check
{
if (place[0][2] == tic || place[0][2] == tac);//move on
else
{
place[0][2] = tac;
move_pass = true;
return move_pass;
}
}
//////////////////////////////////THIRD ROW DOWN/////////////////////////
if (place[0][4] == tic && place[2][4] == tic)//down check
{
if (place[4][4] == tic || place[4][4] == tac);//move on
else
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][4] == tic && place[4][4] == tic)//down check
{
if (place[2][4] == tic || place[2][4] == tac);//move on
else
{
place[2][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][4] == tic && place[4][4] == tic)//down check
{
if (place[0][4] == tic || place[0][4] == tac);//move on
else
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
}
/////////////////////////////TOP DIAGANAL////////////////////////////////
if (place[0][0] == tic && place[2][2] == tic)//diaganal check
{
if (place[4][4] == tic || place[4][4] == tac)//move on
{
if (place[0][4] == toe)
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
else if (place[4][0] == toe)
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
else
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[0][0] == tic && place[4][4] == tic)//diaganal check
{
if (place[2][2] == tic || place[2][2] == tac);//move on
else
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tic && place[4][4] == tic)//diaganal check
{
if (place[0][0] == tic || place[0][0] == tac)//move on
{
if (place[0][4] == toe)
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
else if (place[4][0] == toe)
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
else
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
}
///////////////////////////////BOTTOM DIAGANAL///////////////////////////////////
if (place[4][0] == tic && place[2][2] == tic)//diaganal check
{
if (place[0][4] == tic || place[0][4] == tac)//move on
{
if (place[0][0] == toe)
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
else if (place[4][4] == toe)
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
else
{
place[0][4] = tac;
move_pass = true;
return move_pass;
}
}
if (place[4][0] == tic && place[0][4] == tic)//diaganal check
{
if (place[2][2] == tic || place[2][2] == tac);//move on
else
{
place[2][2] = tac;
move_pass = true;
return move_pass;
}
}
if (place[2][2] == tic && place[0][4] == tic)//diaganal check
{
if (place[4][0] == tac)//move on
{
if (place[0][0] == toe)
{
place[0][0] = tac;
move_pass = true;
return move_pass;
}
else if (place[4][4] == toe)
{
place[4][4] = tac;
move_pass = true;
return move_pass;
}
}
else
{
place[4][0] = tac;
move_pass = true;
return move_pass;
}
}
if (move_pass == false)
{
return false;
}
}
Any feedback would be appreciated
ideas or bugs or what not
Thanks
