TicTacToe first move in first turn delayed

TicTacToe first move in first turn delayed
0.0 0


When I select first move then on first turn when I click on the box it should display the text immediately and then when computer takes it’s next turn it should display it’s text. But what is happening here is when on first turn I click the box it is not displaying the text immediately but is waiting for computer’s response.Why is this happening?Any explanation will be highly appreciated.
Here is the linkn of my project -
tic tac toe


Since you’re using minimax, I suppose it could be just the result of having to calculate a large number of possibilities. I have the same issue when the user goes first.


But the player plays it’s turn first and then it calls the minimax function with that state,so it should first display the value and then go for calculation.If I am writing an alert(‘something’) just after the statement for display then it’s showing the displayed value and then alert is popping up and then after a few seconds computer’s turn value is displayed. The same behaviour should happen without an alert statement!