Tic-tac-toe issues

Hello once again. Like I mentioned in my last post, I’m trying to get the legacy front-end certification. I’m only missing the tic-tac-toe game at this point, but it’s going really badly.

The main game logic is finished, but what concerns me is the algorithm.

For some reason, when there is a corner move available, the thing just goes nuts and tries to play every move, and then goes into an infinite loop.

My project is below:

can you describe how to see this in action?

Sure. Just follow the sequence below:

  1. Choose to play as x
  2. Open the console
  3. Play on literally any square
  4. The thing gets stuck for a few seconds
  5. When it gets unstuck, the algorith goes nuts (both on the board and the console)

Or, alternativetly, just choose to play as O and see what the algorithm comes up with