This should work??
Nov 12, 2013 at 6:30pm UTC
I've been trying to figure this out for a couple days now. I don't understand why this doesn't work. Somehow the Ai while loop causes it not to show moves. I took everything out of the Ai loop except for the move I wanted it to make and it still doesn't show the move.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
while (WindowOpen)
{
if (Menu)
{
std::cout << "1-9 to mark position, press enter to begin." << std::endl;
UpdateMove = false ;
while (Menu2)
{
if (GetAsyncKeyState(VK_RETURN))
{
Menu = false ;
UpdateMove = true ;
Menu2 = false ;
Gamestarted = true ;
Player2 = true ;
AiTurn = true ;
firstturn = true ;
}
}
}
while (Gamestarted = true )
{
if (UpdateMove = true )
{
system("cls" );
std::cout << "|" << Amove[0] << "|" << Amove[1] << "|" << Amove[2] << "|\n-------\n|" << Amove[3] << "|" << Amove[4] << "|" << Amove[5] << "|\n-------\n|" << Amove[6] << "|" << Amove[7] << "|" << Amove[8] << "|\n-------" << std::endl;
std::cout << PlayerTurn;
UpdateMove = false ;
}
while (PlayerTurn = true )
{
if (GetAsyncKeyState('1' ))
{
if (Player2)
{
Amove[0] = 'X' ;
}
UpdateMove = true ;
PlayerTurn = false ;
}
}
while (AiTurn = true )
{
Amove[2] = '0' ;
AiTurn = false ;
PlayerTurn = true ;
UpdateMove = true ;
}
}
}
return 0;
}
Nov 12, 2013 at 6:39pm UTC
the problem I think is with your while loops and line 23...
remember to use "==" instead of "=". One equal sign assigns a value while two equal signs checks if equal to.
Topic archived. No new replies allowed.