DEV Community

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

Collapse
 
bsagortest profile image
bsagortest

2 | |


1 | |


0 | |
0 1 2

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


1 | |


0 | |
0 1 2

AI is playing...
2 X|O|


1 | |


0 | |
0 1 2

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


1 |O|


0 | |
0 1 2

AI is playing...
2 X|O|


1 |O|


0 |X|
0 1 2

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


1 |O|


0 O|X|
0 1 2

AI is playing...
2 X|O|X


1 |O|


0 O|X|
0 1 2

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


1 |O|


0 O|O|
0 1 2

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


1 |O|


0 O|O|
0 1 2

YOU WON?!

Collapse
 
jaeheonshim profile image
Jaeheon Shim

Oh yeah, so... I forgot to make it check to see if you're placing your piece in a spot that is already filled (facepalm)