Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

AI programming

by $CBAS (Scribe)
on May 04, 2001 at 21:50 UTC ( #78049=perlquestion: print w/replies, xml ) Need Help??

$CBAS has asked for the wisdom of the Perl Monks concerning the following question:

This probably sounds like a school assignment but I guarantee you, none of my teachers know enough about computers to ask me for such a thing :-(

Being high-school students, everyone in my class (myself included) gets bored easily when teachers ramble about french poetry and whatnot. We started playing four-in-a-row (I even created my own version which has three colours ... but not many people are smart enough to play it, let alone beat me ;-)), but everyone wants to practice at home (yeah, they're mental).

I was asked by some friends to code a game which they could use to play at home so now I want to learn some A.I. techniques. Can anyone tell me where to start reading? Anyone with experience in coding computer opponents for games? I've never done this and wouldn't know where to start.

I know this is gonna rock, and maybe show some of my classmates that programming is more cool than what we learned about integers and document.writeln() in JavaScript last year ... I nearly cried when the teacher raped the art of programming like that!

Thanks in advance,

Replies are listed 'Best First'.
Re: AI programming
by tinman (Curate) on May 04, 2001 at 22:01 UTC

    I did an AI course last year of university, and there were several sections on game programming in almost all the texts I read.. IIRC, one of the earlier phases of AI involved building machines that could play certain games (checkers, chess, othello) well...

    FWIW, here are some URLs and books from the reading list.. some of them are rather thick, but I do know you can skip to the game programming section.. only problem is that you'd need to convert the principles to the language of your choice :o)

    • P Jackson; Introduction to Expert Systems; AddisonWesley, 1989
    • G F Luger and W A Stubblefield; Artificial Intelligence: Structures and Strategies for Complex Problem Solving; (3rd edition) Addison Wesley 1998
    • Rich E & KNIGHT K, Artificial Intelligence 2nd Edition, McGraw Hill 1991
    • Russell S & Norvig P, Artificial Intelligence A Modern Approach, Prentice-Hall Inc., 1995

    HTH, and good luck.. :o)
    Update: Almost forgot a great resource, UTexas World Lecture Hall.. Go here first :o)
Re: AI programming
by chipmunk (Parson) on May 04, 2001 at 22:48 UTC
    Falkkin wrote a framework for A simple game AI that learns. You could write packages to have it learn your game. The thread includes some general discussion of AI as well.

    (BTW, be careful with the that I wrote using Falkkin's framework. It uses gobs of memory, because I didn't encode the game states compactly. A better encoding was developed in the Chatterbox, but I never got around to posting it.)

Re: AI programming
by frag (Hermit) on May 05, 2001 at 00:11 UTC

    I can't be more of a direct help, but you might try the Perl-AI mailing list. You can subscribe, but first you should try searching the archive, which can be found at or (The latter had a search form last time I checked, but Activesate seems to be unreachable for me right now.)

    Also, and forgive me if I'm stating the obvious, try a search on terms like "ai game-playing" over at Google. A few relevant things popped up for me using those terms.

    -- Frag.

Re: AI programming
by AidanLee (Chaplain) on May 05, 2001 at 00:33 UTC
Re: AI programming
by diskcrash (Hermit) on May 05, 2001 at 04:30 UTC
    Say CBAS,

    There are two major divisions of AI. The first is centered on rule based systems and are sometimes called Expert Systems and/or production engines. They are based on long lists of explicit rules like "If the outside temperature is below x degrees, turn up the thermostat y points, UNLESS some other rule etc."

    The other major AI religion is based on neural networks and Perl has some modules that are used to build such systems. If you use Active State and PPM look for

    • AI-NeuralNet-BackProp
    • AI-NeuralNet-Mesh
    Back Propagation is a means to tune the neural net based upon known outcomes. The Mesh is used to experiment with neural nets. NNs are particluarly suited to answer questions like "Is this a picture of a dog?, regardless of the orientation of the picture. I'd go to Google and/or and search out expert systems and neural nets for the most recent refs. Hurry, we are all anxious to see some system pass the "Turing Test". (Look it up - named for Alan Turning.)


Re: AI programming
by RhetTbull (Curate) on May 05, 2001 at 02:45 UTC
    $CBAS wrote:
    everyone in my class (myself included) gets bored easily when teachers ramble about french poetry and whatnot

    A lot of poetry (including French) is actually quite good. Perhaps if you spent some time listening in class instead of playing four-in-a-row you might learn appreciation for poetry. Even if you end up not liking poetry, learning about it and about why other people like it will make you better.

    and maybe show some of my classmates that programming is more cool than what we learned about integers and document.writeln()

    Your teacher had to start somewhere. I'm doubtful that all your classmates are as brilliant as you are. Give the teacher a break. He/she has to deal with 10's or 100's of whining "I'd rather be playing four-in-a-row" students every day. He/she is probably doing the best they can with the resources and time they have. Many people in a HS CompSci course probably aren't ready for anything more advanced than "document.writeln()". Put yourself in your teachers' shoes now and then. They really do want you to learn -- they wouldn't spend their days working with teenagers for measely salaries if they didn't.

    There's more to life than computers. Take some time to learn about and enjoy some of these things. Maybe even some French poetry

    That said, writing an AI to learn your game is probably a good project. But give your teachers a break -- they really do want to teach you.

      Now, /s?he/ did explicitly say "ramble about french poetry". There's a special place in Hell reserved for teachers who mean well but nonetheless manage to destroy their students' interest in a topic through their own incompetence.

      In any case, I thought I'd point out that Douglas Hofstadter, of "Godel, Escher, Bach" fame, has written a book about the difficulty of translating french poetry, called "Le Ton beau de Marot: In Praise of the Music of Language". Haven't read it myself, though I understand that it includes some discussion of machine translation and AI.

      -- Frag.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://78049]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2020-07-04 18:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found