Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Java A* Implementation in Java

Alpheron

New Coder
Hello Everyone,
I was recently working on a project where I would be given an image of a field in which a robot would traverse and find the optimal path given a start point and endpoint. I was thinking of using converting the image to 1's and 0's depending on an obstacle's positioning on the field and the resolution of which standard of measurement will be used (ie. inch, half-inch). With this field of 1's and 0's, I was thinking of running A* on it in order to find the optimal path between the start point and endpoint. My current implementation of this algorithm can be found here. However, I have seen other's use obstacle classes in order to define obstacles and their positions on the field. Along with the node class. When running my code, it seems to work fine for avoiding obstacles however if there is no path between the start point and the endpoint, the algorithm seems to go haywire and come up with a random path. How would I be able to solve this problem and perhaps improve my implementation?

Thanks in advance!
 
Looks like an interesting problem, I may take a look at it when I get a chance. I think it would be beneficial to wrap coordinates into a Point class for readability. I did have a quick look into the A* algorithm, looks like something good to learn.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom