Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Looking for example for avoidance code
 

Looking for example for avoidance code

I am looking for example code for going around a plant when blocked, or going wide around a carnivore.
MigrationUser 1  Wednesday, June 11, 2003 5:17 PM
You can use movecompletedeventargs (look at the object model) to find if you made it or was blocked, and then find out the blocking organism. After you find you are blocked, use a pathfinding algorithm like A* to calculate a new route. Quite a lot of code to do well, though.
Tell me if you adapt successfully it because I need to write it too! :)
MigrationUser 1  Wednesday, June 11, 2003 10:50 PM
I am already using the movecompletedeventargs and I do know which organism is blocking, but what do you mean by using a pathfinding algorithy like A*.  Are there some already written.  I am hoping not to write one from scratch, as my geometry is a little rusty.
MigrationUser 1  Friday, June 13, 2003 12:14 AM
I'm working on a pathfinding package for Terrarium developers.  However, it'll be a while before it's ready for prime time.  In the mean time, you might want to check out this site which has a very good tutorial on A*: http://www.policyalmanac.org/games/aStarTutorial.htm
After you have read the tutorial, you can either roll your own or you can use an A* package from the Animal Farm.  It's available in the .chm file at http://www.yllemo.com/terrarium.

Having said that, A* works great if you know where you're going.  My herbivores use Dykstra which allows them to search for the "best" place that they can get to.  The down side to my approach is that it is much slower than A*.  My pathfinding package will contain both methods.
MigrationUser 1  Friday, June 13, 2003 12:07 PM

You can use google to search for other answers

Custom Search

More Threads

• SQLHelper.ExecuteReader error.
• Amazing !!!
• install IssueVision on client
• What is the user id and password for task vision client
• Plugin frame work
• Change Windows Language
• RemoveExistingProduct + Major Upgrade
• xmlfile
• Why DataGridView always throw an NullReferenceException when input value at the first time after pressing ESC ??????????????
• Related to Windows Forms