Help regarding about launching AI in Tic Tac Toe project

Help regarding about launching AI in Tic Tac Toe project
0

#1

Hi, just managed to finished a 2 player version of the project but now having trouble launching the AI portion. I am not sure if my logic is wrong or the general set up of the code.

I set the state of human and AI with flags, if one runs, they switch the flag to on and off with 1 and 0. I have set up 9 click events and at this stage once the human player clicks on the button, the AI would be switch to 1 but for some reason outside of the click events my AI test function simply just doesn’t run even if it meets the condition. Thank you for looking into this.

if ( AI == 1) {
run_AI();
}