-
Notifications
You must be signed in to change notification settings - Fork 0
How to use
Haeki edited this page Apr 8, 2016
·
3 revisions
Please follow the install instructions first.
If you want to see log results you can start the program in a shell (cmd, ...).
java -jar pathTo/javakara.jar
The world should only consist out of trees as walls. Furthermore it must contain kara and one leaf as destination. To keep the calculating time low the world size should be not greater than 32x32. Also the speed should be quite fast.
The first step is to create the PathFinder Object.
- create the variable:
Pathfinder pathFinder;
- create the new Object:
pathFinder = new PathFinder(tools, world, kara);
Now you can run the entire algorithm with: pathFinder.start();
The alternative is to call the Two methods directly:
- Use
pathFinder.scanWorld();
to find to paths that Kara can use in the world. - Use
pathFinder.runAlgo();
to run the algorithm and find the shortest Path. - Use
pathFinder.laufePfad();
to let Kara follow the found path.
There are some special things you can do:
- You can change the type of search algorithm.
- The function for that is
pathFinder.setSuchType(type);
and must be called before the algorithm. - The different types are:
PathFinderAlgo.SuchType.tiefenSuche
,PathFinderAlgo.SuchType.breitenSuche
,PathFinderAlgo.SuchType.dijkstraSuche
andPathFinderAlgo.SuchType.aStarSuche
. - use Wikipedia to find out more about them.
- You can also mark the crossings with mushrooms:
- The function for that is
pathFinder.markKreuzungen();
- The nushrooms will mess up kara if it tries to follow the path so do not use them together.