DEV Community

Discussion on: I wrote an unbeatable Tic-Tac-Toe AI in Java

Collapse
 
suchitrakartic profile image
suchitrakarthik

2 | |


1 | |


0 | |
0 1 2

Enter position (x, y): 1,1
2 | |


1 |O|


0 | |
0 1 2

AI is playing...
2 X| |


1 |O|


0 | |
0 1 2

Enter position (x, y): 0,2
2 O| |


1 |O|


0 | |
0 1 2

AI is playing...
2 O|X|


1 |O|


0 | |
0 1 2

Enter position (x, y): 2,0
2 O|X|


1 |O|


0 | |O
0 1 2

=======================
Game Finished!
2 O|X|


1 |O|


0 | |O
0 1 2

YOU WON?!

Collapse
 
jaeheonshim profile image
Jaeheon Shim

This is because you placed a piece in a spot that already has a piece, I forgot to check for that in my code