I am having a hard time getting the AI function to work. Here is my dilemma…Every time I run the code, the function sets the computer player to the next sequentially available space. I totally confused. Here is the link to the codepen: https://codepen.io/oclaros/pen/BwXRzG
Thank you for the suggestion, however, I have tried to implement the minimax algorithm. It keeps returning the next sequential free space/cell number. I need another pair of eyes to tell me where I went wrong and possibly why I did not code the algorithm correctly.