while(PlayerTurn)loop is called in relation to your
while(AiTurn)loop. Are they in the same function?
while (GameStarted)loop, but that's not immediately obvious because you've indented them as if they weren't inside it.
while (playerTurn)loop exit, and the
while(AiTurn)loop. But you're still inside the
while(Gamestarted)loop, so you begin the next iteration of that loop.
while(PlayerTurn)again, PlayerTurn is true - because you set it to true the last time you changed AiTurn to false, so the
while(PlayerTurn)loop runs again
while(Gamestarted)loop never exits.
|I'm going to start coding that way after I finish this because I really don't want to have to redo everything.|
|but I'm not used to coding with functions because I never saw I point in it|
|You never set GameStarted to false, so the while(Gamestarted) loop never exits.|
|When I run the code I want it so, I can only press one key for that turn, so I might only 1 move and then the Ai goes. But instead I can press all the keys, so if I press 1-9 it would look like:|
It would be like if you were playing Tic Tac Toe in real life and your partner goes one time then you go, but instead of drawing one X you just draw them in all the spots instead.
while (playerTurn)loop must be exitting, and the
while (AiTurn)loop must be entering.
while (AiTurn)loop setting AiTurn to false without actually recording the move.
|One more thing I wanted to say, what did you mean by|
You never set GameStarted to false, so the while(Gamestarted) loop never exits.
I have it set at the top. Or did you mean I never set it to false to end the loop? If so, the reason why I haven't done that yet is because I haven't finished what I'm working on yet. Maybe I'm just misunderstanding what you mean, wwwiii mentioned that also.