Tic Tac Toe

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Chyse
Posts: 1574
Joined: Thu Jun 24, 2004 10:24 pm

Tic Tac Toe

Post 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
"Your neighbor was kind enough to let us rip him off and burn his furniture for no reason."-ATHF
"He said no, Err. With his foot." -ATHF
"Please, stop fueling my silent rage." -ATHF
Image
scherzo
Posts: 497
Joined: Sun Sep 10, 2006 3:05 am

Tic Tac Toe

Post 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
Image
User avatar
Bookworm
Posts: 2828
Joined: Tue Aug 24, 2004 12:04 am

Tic Tac Toe

Post 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
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Tic Tac Toe

Post 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
Honk if you love Jesus, text if you want to meet Him!
Locked