Tic-tac-toe is finally unbeatable

I think it is, anyway.
Critical feedback, please, on all aspects of project.

I won :smile_cat:

  1. Select a corner
  2. AI chooses the center box
  3. Select the corner on the other extreme
  4. You win

It looks good!

Try now!

Now I can’t win :+1:

I managed to beat it :slight_smile:

You start first:

  1. Select bottom left
  2. AI selects center
  3. Select center right
  4. Win

Good call.
Thanks for testing.

Really good solution! Haha your game is awesome :slight_smile:

1 Like

Excellent work. I :heart:ed it on CodePen. Was unable to beat it.

1 Like

you got me. nice work.

1 Like

I was able to beat it with @martiuslim’s method.

Me: Bottom Left
AI: Center
Me: Center Right
AI: Upper Left
Me: Bottom Right
AI: Upper Right
Me: Bottom Center


The interesting thing is that this doesn’t work when you reverse it (start in a different corner but follow the same pattern). It appears that the AI always selects the uppermost square it can when it’s on the offensive. So the only way to beat it is to create a monopoly on the lower section of the board without triggering it’s defensive reasoning until it’s too late.

When I place a marker in the lower area (without creating two in a row) it seems to ignore it and proceed with trying to make it’s own row; however, if I place a marker in the upper area (regardless of where it is in relation to my other markers) the AI immediately chooses a square next to mine to cut me off.

Regardless, absolutely fantastic game! I had fun picking it’s brain. :wink:

1 Like