Saturday, November 21, 2015

How to Win at Tic Tac Toe

tic tac toe

It is not difficult to write a computer algorithm to play Tic-Tac-Toe that never loses.
http://www.quora.com/Is-there-a-way-to-never-lose-at-Tic-Tac-Toe

But what is the 'best' strategy for a computer to *win* at Tic-Tac-Toe?
 http://www.cs.jhu.edu/~jorgev/cs106/ttt.pdf
(i believe there's a mistake where one of the moves the author says leads to a win, is actually a tying play, but overall he does give good analysis on how to play moves to *win*)

sure the easiest "unbeatable" algorithm is to pick the safest choice, but that is unlikely to beat an opponent because the strategy is predictable and often forces a tie situation.

what would be a more "expert" algorithm is to pick the option that gives the opponent the most chances to lose, since tie is always assured for the computer.

so this is a case where the "best" move cannot be solely determined by best possible outcome for itself. "selfish greed".

it needs to realize it is untouchable, and start figuring out ways to trip up the opponent. lure the human to make mistakes!


an interesting experiment would be to send out a tic-tac-toe computer program with safe algorithm that makes the "safest" moves that prevent the other player from winning. (generates more ties)

to the "risky" algorithm that avoids the moves with high chance of ties.

tell the user that you are testing the code for a small programming project and ask them if they can try different things see if they can beat the computer to see if there is a coding mistake ( there are none, the test is to see how well the players perform not the machine). have each program have a counter that secretly keeps track of how many times the player loses vs times played.

see how well the risky algorithm can outperform the safe one.

just straight up testing, try to beat this algorithm with two groups, one given the safe and one given the risky version. and see which one generates more losses for the human. we should expect the risky version would make the human lose more. this would be the control case.


then try another experiment to see if humans perform worse when they think the computer is likely to make mistakes. see if human players are more prone to lose against an opponent they perceive to be weak.

say like 'the algorithm never loses, but i'm not sure all the logic is correct, there's probably a lot of cases I missed where you give an obvious play to the computer and it doesn't do the right move. it's not supposed to lose, so don't let the computer beat you. but see if you can try different move combinations even where you think the computer should win to see if there's any bugs and the computer loses.'

give one group the safe, the other risky version. see if humans perform worse compared to the control case.


Then you could do a two part experiment, where a group is given one version to start, and then asked to test again with the other version.

give one group the risky algorithm to start and say it's not finished yet, there may be some errors with the AI. then say with help of users like you they found and fixed a small number issues give them the safe algorithm and ask them to test again

with another group. still say the starting algorithm has bugs and the next one is updated. but this time start with the safe algorithm and ask them to test again with the risky algorithm.

this is to check if it's the play of the computer that makes the human perceive it to be weak, or because another person said so.

No comments:

Post a Comment

You can add Images, Colored Text and more to your comment.
See instructions at http://macrolayer.blogspot.com..