Skip to content

How to use

Haeki edited this page Apr 8, 2016 · 3 revisions

Please follow the install instructions first.

Starting:

If you want to see log results you can start the program in a shell (cmd, ...).
java -jar pathTo/javakara.jar

World:

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.

Program:

The first step is to create the PathFinder Object.

  1. create the variable: Pathfinder pathFinder;
  2. 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:

  1. Use pathFinder.scanWorld(); to find to paths that Kara can use in the world.
  2. Use pathFinder.runAlgo(); to run the algorithm and find the shortest Path.
  3. Use pathFinder.laufePfad(); to let Kara follow the found path.

There are some special things you can do:

  1. 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 and PathFinderAlgo.SuchType.aStarSuche.
  • use Wikipedia to find out more about them.
  1. 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.
Clone this wiki locally