home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Tic Tac Toe AI??

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2902
Discussions: 200,967, Posts: 2,379,664, Members: 246,333
Old March 21st, 2003, 01:13 PM     #11 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 7,385
Send a message via ICQ to Creatures
sorry what is LISP?

and i hate to play reversi because i loose all the time =)

Creatures
__________________
Canon EOS 450D | Canon EF-S 18-55mm 1:3.5-5.6 IS | Canon EF-S 55-250mm 1:4-5.6 IS | Canon Speedlite 430EX II
Creatures is offline   Reply With Quote
Old March 21st, 2003, 01:40 PM     #12 (permalink)
Member
 
quux's Avatar
 
Join Date: Nov 2002
Location: Hamburg
Posts: 244
LISP is ...

about the oldest programming language still relevant
(List Processing) and was quite of an importance in the early days of AI.

It is however quite cumbersome to deal with as it heavily relies on parens.

Todate, you might of course use PERL as well (for instance).

... if you prgramm REVERSI you will afterwards win as you have to develop a (dynamic) weighting for the fields which helps a lot to win.

Another nice one is the Tower of Hanoi

CC.

EDIT add (History of LISP):

http://www-formal.stanford.edu/jmc/h...lisp/lisp.html
__________________
*** all that we C or Scheme is
but a dream within a dream ***

Last edited by quux : March 21st, 2003 at 01:44 PM.
quux is offline   Reply With Quote
Old March 22nd, 2003, 12:13 AM     #13 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
...but the computer will never loose this way...

Quote:
get really good at ttt. never lose, win OR tie.

ttt player, NEVER lose, win OR tie.

have you ever played the game...
qball is offline   Reply With Quote
Old March 22nd, 2003, 01:38 AM     #14 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 7,385
Send a message via ICQ to Creatures
well not with the PC =)
normally i win but now with this (not finished) progrm it looks like that i will lose =)

Creatures
Creatures is offline   Reply With Quote
Old March 22nd, 2003, 04:54 AM     #15 (permalink)
Member
 
Join Date: Mar 2002
Location: BYU - Provo
Posts: 43
Send a message via AIM to Fractile81 Send a message via Yahoo to Fractile81
Well, as my roommate just pointed out, there IS a way that you could beat the computer, but it would require that the player 1) goes first, and 2) picks two corners which are diagonally across from themselves (computer blocks center). Then, all they do is place in one of the remaining corners. Computer can only block one of the two possible lines. The player then wins .

_O_|_X_|_O_
___|_X_|_ O_
X | | O // Possible winning situiation

You are right that there is a degree of randomness that would be needed, but after the first 3 moves or so, you have to be countering the other persons moves before they'll win. Really, Tic-Tac-Toe does not take luck at all, but it is more a matter of who gets their "trap" setup first.

Just some more to think about .
__________________
-Fractile81
Fractile81 is offline   Reply With Quote
Old March 22nd, 2003, 07:03 AM     #16 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 7,385
Send a message via ICQ to Creatures
yeah this is a good situation! but i found another one

_O_|_X_|_O_ // player left top corner
___|_X_|___ // PC middle
___|___|_O_ // player bottom right corner and hope that the PC wont chose top right corner

Creatures
Creatures is offline   Reply With Quote
Old March 22nd, 2003, 07:47 AM     #17 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Location: Augsburg, Germany
Posts: 5,586
Build a tree of all possible moves (there are less than 3^9=19683 possible situations in TTT), then use a so called minmax algorithm to take the branch that is best for him and worst for the opponent.

While you certainly learn something coding it, the result will be boring. TTT games between two players that aren't entirely stupid ALWAYS lead to a tie.

Last edited by Peter M : March 22nd, 2003 at 07:52 AM.
Peter M is offline   Reply With Quote
Old March 22nd, 2003, 08:21 PM     #18 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 7,385
Send a message via ICQ to Creatures
yep i agree! the tree thing sounds good, but i have to find out how tis works =)

thanks again
Creatures
Creatures is offline   Reply With Quote
Old March 22nd, 2003, 10:13 PM     #19 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
Quote:
there IS a way that you could beat the computer, but it would require that the player 1) goes first, and 2) picks two corners which are diagonally across from themselves (computer blocks center).

guess y'all never played or mastered the game. Going first is an advantage, though small. Regardless of whether I go first or second...

ttt player, NEVER lose, win OR tie.

The above example, not true, in fact bad play. Going first, always choose center...

Why not true:
1|2|3
4|5|6
7|8|9

I go first (as x), select 1.
kompewter takes 5.
I take 9.
we now have:

X|2|3
4|O|6
7|8|X

kompewter takes 2.
I NEED to go 8, else lose!

we now have:

X|O|3
4|O|6
7|X|X

kompewter takes 7, or lose.
we now have:

X|O|3
4|O|6
O|X|X

I NEED to take 3, or lose.

we now have:

X|O|X
4|O|6
O|X|X

Where do you think kompewter goes?

Tie.

Quote:
Build a tree of all possible moves (there are less than 3^9=19683 possible situations in TTT), then use a so called minmax algorithm to take the branch that is best for him and worst for the opponent.

You could do that, but I wouldn't want to code for 20k possibilities. Plus, board is symmetrical, so could be 20k/3...

[thinking off the top of me ears]
There is only 8 ways to win, 3 rows, 3 cols, 2 diags. Determine where to go based upon those values, with some other logic tossed in. As in where to go, if first.
[/thinking off the top of me ears]

I've done ttt programs, that allowed people to play each other, never did the 'computer' as:

Quote:
While you certainly learn something coding it, the result will be boring. TTT games between two players that aren't entirely stupid ALWAYS lead to a tie.

Learning...PRICELESS!
qball is offline   Reply With Quote
Old March 23rd, 2003, 05:38 AM     #20 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 7,385
Send a message via ICQ to Creatures
you're right, now i see my problem!

thanks again!
Creatures
Creatures is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3023)
Forty-six years ago today (11)
The disrespect of Obama by Russian .. (46)
Laptop with wireless problem. (12)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
Internet Lost (5)
windows 7 problem (7)
windows vista security holes (15)
Point and Shoot Camera Suggestions. (6)
Is the PSU I received dead? (13)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Recent Discussions
Delete an OS (8)
help me pls laptop just stopped worki.. (0)
Open With ..... Win7 (3)
windows vista security holes (15)
Help getting around port 80 for camer.. (4)
Laptop with wireless problem. (12)
Internet Lost (5)
Skillsoft Network+ Study Software Que.. (9)
virus blocking exe. files (1)
Point and Shoot Camera Suggestions. (6)
CPU fan stops spinning randomly (11)
Nvidia GTX 260 problem (1)
Modern Warfare 2: Who Bought It? (65)
Is the PSU I received dead? (13)
Print spooler problem (16)
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
webcam (0)
upgrade for hp a6101 (0)
tv not turn on-makes clicking sound (2)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Virus advise (8)
My monitor won't turn on after instal.. (1)


All times are GMT -4. The time now is 04:04 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28