Tic-tac-toe is finally unbeatable

Tic-tac-toe is finally unbeatable
0.0 0

#1

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


#2

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!


#4

Try now!


#5

Now I can’t win :+1:


#6

I managed to beat it :slight_smile:

You start first:

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

#7

Good call.
Thanks for testing.


#8

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


#9

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


#10

you got me. nice work.


#11

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

Victory!

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: