Hi all I am continuing my tic tac toe project while I meet another problem. When I load the functions, the system keeps responding ‘Uncaught RangeError: Maximum call stack size exceeded’ or ‘Cannot read property ‘NaN’ of undefined’ on function mousePressed( ). Would like to ask what the problem is and how to solve it. Thanks!
Hello,
You are calling aiTurn()
inside of mousePressed()
which in turn call mousePressed()
. You are creating an infinite loop and that’s why you have a stack overflow.
4 Likes
Thank you! I then remove the mousePressed( ) in aiTurn( ). But then I cannot put the cross in it. When I have already indicated HumanCurrentPlayer = true in aiTurn( ), it should be working. Would like to ask why is it happening and how to solve it? Thanksss.
Just take a moment to solve it on your own
yah sure will do it thank you btw
1 Like