Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Efficient algorithm to find the shortest path between two points in a Grid  RSS feed

 
Greenhorn
Posts: 12
Android Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be a good and simple algorithm to find the shortest route between two points in a 2D array[grid] ? There can be certain obstacles in the grid i.e. some of the cells may be inaccessible. I tried googling for it and found that A* is the best for this but I am just a beginner and would like to start with something much simpler.

Thanks in advance for your tips and suggestions.
 
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google search source code for MineSweeper.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how Roger's advice would really help you here.

With most programming problems/tasks, the best thing to do at first is figure out how YOU would do it. Imagine you are standing on a grid, and you have to get from where you are to some other point, and there may be obstacles in the way.

How would you walk across the grid so that you end up at your destination?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!