Needs a bit of work.
You are welcome to use my formula for unbeatable TIC-TAC-TOE.
Computer always goes first, in center. Label boxes from the top-left:
1, 2, 3
4, X, 6
7, 8, 9
Then when computer moves have it follow this table:
2, 1, 6
7, X, 3
4, 9, 8
So - if the player goes to square 4, then computer goes to 7.
Plays an unbeatable game and no need to even check if squares are already filled when computer moves. Just look for valid win.
Hope This Helps !
P#31480 2016-10-22 17:11 ( Edited 2016-10-22 21:11)
"Unbeatable" isn't fun, though. The trick is to make it challenging and competent, but not totally unbeatable.
P#31651 2016-10-24 07:20 ( Edited 2016-10-24 11:20)
[Please log in to post a comment]