Results 1 to 2 of 2
  1. #1
    magichaxx is offline Member
    Join Date
    Nov 2013
    Rep Power

    Default Java A* Pathfinder Help Needed

    I need help understanding what pathfinding in java is and how it works, but I can't find a good tutorial that doesn't use graphics. Can someone please help me understand how it works just by using code? I need some visuals as to what exactly an A* algorithm needs in code.

  2. #2
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Rep Power

    Default Re: Java A* Pathfinder Help Needed

    Basically, you have a heuristic value, a move cost, and a total cost. For every passable tile (assuming you have tiles) you find the heuristic, this can be done using the Manhattan method. It is the difference in x plus the difference in y from the start to the end. You then set the move cost, this can be done however you like, lets say all linear movements (up, down, left, and right) have a cost of 10, and all non linear (diagonal) movements have a cost of 20, basically that means is costs twice as much to move diagonal as it does to move linear. Now, the total cost is the movement cost plus the heuristic. You want to make a list of all tiles (open list) that are touching you (except the one you are on, add this to a 'closed' list), these are the tiles to set the values for, when you move to the one with the lowest value, clear the open list and add the new tile to the closed list. Repeat. Remember, if your tiles are not moving, you can calculate the heuristic before hand, and not have to re calculate. I hope I have explained this well enough.
    1000011 1100001 1101110 100000 1111001 1101111 1110101 100000 1110010 1100101 1100001 1100100 100000 1000010 1101001 1101110 1100001 1110010 1111001 111111

Similar Threads

  1. Replies: 0
    Last Post: 02-05-2013, 02:17 PM
  2. A* Pathfinder
    By m00nchile in forum New To Java
    Replies: 0
    Last Post: 02-17-2010, 07:37 AM
  3. JPF (Java Pathfinder) - "no main"
    By andrew in forum Eclipse
    Replies: 1
    Last Post: 03-25-2009, 07:32 AM
  4. Java experts needed- 30 minute online Java projects
    By michelle in forum Jobs Offered
    Replies: 0
    Last Post: 03-06-2008, 12:47 AM
  5. Java help needed
    By jeneal in forum New To Java
    Replies: 0
    Last Post: 11-21-2007, 04:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts