Sender: mckee AT rtp DOT gtegsc DOT com Message-ID: <3365FA38.3A96@rtp.gtegsc.com> Date: Tue, 29 Apr 1997 09:40:08 -0400 From: David McKee Organization: GTE (My views are my own) MIME-Version: 1.0 To: solyom AT eik DOT bme DOT hu CC: djgpp Subject: Re: Q: A good algorithm to catch me needed References: <3365AB6A DOT 2CC9 AT eik DOT bme DOT hu> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Precedence: bulk Dr. Andras Sólyom wrote: > > 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 I would use a modified version of the depth search that automated Chess games use, where the computer "rats" are using your (the player rat) current posistion as the goal. Each possible path to you would then be assigned to a different pursuit rat until the computer either ran out of rats or paths to pursue. By using the chess style tree/search ahead algorithm, you can program the pursuit rats to "look-ahead" to all possible moves you might make and then pick the most likely based on how close each move would get you to your goal (the cheese...). This should give your rats that "AI" feel... -- David T. McKee: ======================Signature Block==================== "The unexamined Life is not worth living..." Plato --------------------------------------------------------- "Look at the Fish!" Louis Agassiz --------------------------------------------------------- It is the glory of God to conceal a matter; To search out a matter is the glory of kings. Pr 25:2 --------------------------------------------------------- There is nothing so sacred as it cannot be looked into... =========================================================