Page 1 of 1

Tic Tac Toe

Posted: Thu Mar 13, 2008 2:03 pm
by Chyse
I need a program that runs Tic Tac Toe. It needs to be in Java. And the computer has to use perfect logic, so it never loses, only ties. I've been searching for a program for two days, if you've got one or know of one that you have the source code for, please let me know.

Archived topic from Anythingforums, old topic ID:3532, old post ID:65087

Tic Tac Toe

Posted: Sat Mar 15, 2008 3:34 am
by scherzo
goalguarder12 wrote: I need a program that runs Tic Tac Toe. It needs to be in Java. And the computer has to use perfect logic, so it never loses, only ties. I've been searching for a program for two days, if you've got one or know of one that you have the source code for, please let me know.
I'm sure with tic tac toe, there are only a certain amount of opening moves that do not result in a loss, therefore it wouldn't be so much 'logic' but a random pattern in a cycle
255,168 unique games of Tic Tac Toe to be played. Of these, 131,184 are won by the first player, 77,904 are won by the second player, and 46,080 are drawn.
might help you out

http://www.jesperjuul.net/ludologist/?p=55

I have the file here, but no actual tree:
http://www.jesperjuul.net/tictactoe/allgamesoftictactoe.zip

Archived topic from Anythingforums, old topic ID:3532, old post ID:65129

Tic Tac Toe

Posted: Thu Mar 20, 2008 11:25 pm
by Bookworm
Before my older brother died in 1975, he had programmed his high school's computer to play tic tac toe. The computer had to make the first move for the computer to always win or tie. At least that was the way my brother programmed it. If the other person makes the first move, then the computer could lose. My brother showed me the opening move, so I never lose if I'm playing and I start the game first. :dance:

Archived topic from Anythingforums, old topic ID:3532, old post ID:65180

Tic Tac Toe

Posted: Fri Mar 21, 2008 12:34 am
by Red Squirrel
I made a battleship game in C++ a while back. The AI was based on randomization and part probability. Like if you have this:

xax*
*x*x
****
****

(x already tried but no ship, a and * not hit)

Then you know its pointless to try hitting a since the smallest ship takes 2 tiles. If that ship was sunk then it knew the smallest ship is 3 and so on.

Archived topic from Anythingforums, old topic ID:3532, old post ID:65182