Tic Tac Toe AI??  | | |
March 21st, 2003, 01:13 PM
|
#11 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 7,385
|
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 |
| |
March 21st, 2003, 01:40 PM
|
#12 (permalink)
| | Member
Join Date: Nov 2002 Location: Hamburg
Posts: 244
|
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.
|
| |
March 22nd, 2003, 12:13 AM
|
#13 (permalink)
| | Banned
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... |
| |
March 22nd, 2003, 01:38 AM
|
#14 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 7,385
|
well not with the PC =)
normally i win but now with this (not finished) progrm it looks like that i will lose =)
Creatures |
| |
March 22nd, 2003, 04:54 AM
|
#15 (permalink)
| | Member
Join Date: Mar 2002 Location: BYU - Provo
Posts: 43
|
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
|
| |
March 22nd, 2003, 07:03 AM
|
#16 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 7,385
|
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 |
| |
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.
|
| |
March 22nd, 2003, 08:21 PM
|
#18 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 7,385
|
yep i agree! the tree thing sounds good, but i have to find out how tis works =)
thanks again
Creatures |
| |
March 22nd, 2003, 10:13 PM
|
#19 (permalink)
| | Banned
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! |
| |
March 23rd, 2003, 05:38 AM
|
#20 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 7,385
|
you're right, now i see my problem!
thanks again!
Creatures |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |