Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: A simple game AI that learns

by Nimster (Sexton)
on Jan 16, 2001 at 14:57 UTC ( [id://52208]=note: print w/replies, xml ) Need Help??


in reply to A simple game AI that learns

If you want to do something *really* cool, that will surely show how the AI is by far superior, develop 3D tic-tac-toe, or even checkers for it. Those games have more combinations, and thus after X games, the AI has a bigger advantage. Checkers shouldn't be too hard to develop (you can use the same tic tac toe diagram of which places are taken by what, only 8x8 in size), win happens when one player has no tokens, and when a square is taken, and the square beyond it is free, the AI may move to the square beyond it and "kill" a token. You have to allow them to move backwards for a solvable play, and you can program a "queen" (when a token reaches the end of the board) later. 3D-tic-tac-toe is even easier, you simply edit the tic-tac-toe for 3-dimensional lists, and change the combos. I'm safely assuming this would take about 4,000,000 games just to reach the state of absolute superiority for the AI, since there are more combinations.
Also - there's a chance of infinite game in checkers, although once you do program a queen, the chance is much lower (since the queen can move across the whole board). It will be slower to run, of course.
I believe after enough runs in this game you will reach a state where the AI wins every single time over the random player. I also believe, that it will require the AI less runs to reach such a state in checkers than it did for the tic-tac-toe AI, in relation to the number of possibilities. (i.e it will take it more, but less if you divide that number by the number of possibilities)
Also - you can try and adapt my Perl Hangman to the AI, this time not with 2 players, but an AI going against the number of failed guesses (trying to reach minimum). I wonder how will that work, since in hangman you basically guess letters. Giving preference to certain letters means at some point it will build a table of the most common letters in the english letters, and then you can completely throw it off by giving it Xzxyqv for example. :)
I'll try working on Checkers for perl, then see if I can place it in your code, or just give it to you if you want.
A list of combination for 3D tic-tac-toe
each of the regular tic tac toe combos, on each plane (z=0,1,2): [(0,1),(1,1),(2,1)] [(x,0)(x,1)(x,2)] types each of the regular tic toe combos, with each of the parts of the comb +o, on serial planes (0,1,2 or 2,1,0): [(0,0),(1,1),(2,2)]

I hope you understood me in spite of my lackluster english. Other than that, amazing work, of course I ++'ed it, and the guy who did it for connect 4 - you too.

-Nimster

Replies are listed 'Best First'.
Re: Re: A simple game AI that learns
by Falkkin (Chaplain) on Jan 16, 2001 at 20:50 UTC
    I agree that checkers is probably the game which will be most interesting to see this AI play.

    There's currently one technical problem that needs to be solved before a feasible checkers AI can be generated, however: we need to use less space in memory. The Connect 4 AI uses up about 100 MB of memory once it plays up to about 70,000 games; there is simply too much state information to keep it all resident in memory at once. My computer has 96 MB of memory, and crawls to a halt after the memory size blows up.

    A side effect of the huge amount of memory taken by the program is that it's also about 100 MB to write out the state information to disk. I plan on using Storable to store the data onto disk, because it should take up less space, and maybe tying the state data to some sort of database such that we don't have to keep it all in memory at once. We could also decide to pack state info into a more concise form than strings; that should save on space, but I doubt that the small savings there (on the order of using roughly 5x less space) would be enough savings to make checkers (or even connect four) viable.

    All this space doubles if you choose to use another AI player (as opposed to the Random player) for the second player.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://52208]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-20 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found