Minimax function not working for 4×4, 5×5, 6×6 list
I am currently trying to implement a simple tic tac toe game in flutter. I am using a minimax function to calculate the AI player moves. For the simplest 3×3 list array, the minimax function works perfectly. But when i try to use the same minimax function for 4×4,5×5, 6×6 list array(to make the game a little bit more complex and interesting), the minimax function seems to run endlessly without returning a move, no matter what i do(i added alpha-beta pruning to no avail). What am i doing wrong. Any help will be appreciated. The following are the main functions i am using: