From: nitehawk91 AT aol DOT com (NiteHawk91) Newsgroups: comp.os.msdos.djgpp Subject: Re: Q: A good algorithm to catch me needed Date: 29 Apr 1997 20:11:18 GMT Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com Lines: 45 Message-ID: <19970429200900.QAA26504@ladder01.news.aol.com> NNTP-Posting-Host: ladder01.news.aol.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Im Artikel <3365AB6A DOT 2CC9 AT eik DOT bme DOT hu>, "Dr. Andras Sólyom" schreibt: > >I tried to re-create a game I enjoyed on a C64 long ago, called Rat Race >in Allegro. The game is about collecting cheese in a labirinth with a >rat while some other rats are trying to catch me and some cats are >trying to trap me. Everything is working, but the pursuers are very >stupid, it is easy to evade them. I remember that on the Commodore they >were very clever and always tried to corner me, some running ahead on >one or both sides then turning around toward me, some were chasing me >from behind, etc. And they had never got caught in the labirinth. > >How can I achieve this in my game? Any suggestions? > > Andras Hi Andras ! Well, I don't know about how to code a good KI, but I want to give it a try. I'm puzzled if there's a common KI algorithm in all these strategy games... Anyway, first you should always have the position from your Rats handy. Now you could check for the distance between (e.g. you have three rats, one is the player and two opponents) the enemys and the good guy. Then have a look on the possible ways to the players rat and the possible ways from the players rat to the exit. Now you could only make a guess about how the human player would behave (in this case : in what dircetion may he go). I think it's very important to make a guess, because someone could easyly code KI rats that catch you everytime. You could improve your *guess* code by looking at players or at you, when you play the game. How does someone behave if he's in a certain situation and such things... Not a that easy job. And I'll bet there's no *always* usable algorithm for that. So, good luck ! Matthias *Artificial intelligence is better than natural stupidity P.S. : Just interested : is that article off-topic for that NG ?