Questions tagged [path-finding]

Pathfinding generally refers to the problem of finding the shortest route between two points, subject to any obstacles. Pathfinding has application in a wide range of areas including robotics and game development. Algorithms for pathfinding tend to be closely related to graph and tree search algorithms.

Pathfinding generally refers to the problem of finding the shortest route between two points, subject to any obstacles. Pathfinding has application in a wide range of areas including robotics and game development. Algorithms for pathfinding tend to be closely related to graph and tree search algorithms.

Significant Literature

External Links

Related Tags

1746 questions
26
votes
0 answers

How do I implement an A* pathfinding algorithm, with movement costs for every programming language?

Can we get people to post code of simple, optimized implementations of the A* pathfinding algorithm, in every single language? This is mostly for fun and to play with what stackoverflow itself is capable of... although I actually am interested in…
IQpierce
  • 501
  • 2
  • 8
  • 17
26
votes
8 answers

Efficient Path finding algorithm avoiding zigzag's

I am developing a software which connects objects with wires. This wiring has a rule that these wires cannot pass on other objects and no diagonal move is accepted. All of the shortest path algorithms that i know (A*, dijkstra etc.) find this type…
Alper
  • 771
  • 1
  • 9
  • 27
26
votes
5 answers

Indefinitely move objects around randomly without collision

I have an application where I need to move a number of objects around on the screen in a random fashion and they can not bump into each other. I'm looking for an algorithm that will allow me to generate the paths that don't create collisions and can…
Paul de Lange
  • 10,613
  • 10
  • 41
  • 56
24
votes
1 answer

Manhattan distance is over estimating and making me crazy

I'm implementing a-star algorithm with Manhattan distance to solve the 8-puzzle (in C). It seems to work very well and passes a lot of unit tests but it fails to find the shortest path in one case (it finds 27 steps instead of 25). When I change the…
Babak
  • 582
  • 4
  • 14
23
votes
2 answers

A* admissible heuristics on a grid with teleporters?

Suppose that you have a 2D grid of cells, some of which are filled in with walls. Characters can take a step from one square to any square that is one step horizontal or vertical from it, but cannot cross walls. Given a start position and an end…
templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
22
votes
7 answers

Pathfinding on large map

I'm creating a game with a 10,000 by 10,000 map. I would like for a user to be able to set a location and have the computer instantly find the best path. However, since the map is 10,000 by 10,000, there are 100,000,000 nodes, and to find this path…
James McDowell
  • 2,668
  • 1
  • 14
  • 27
21
votes
1 answer

How to find multidimensional path of exact 0 cost with 1, 0, -1 weights

I was given directed graph with n nodes and edges with weigths of vectors (every vector has length m) of numbers 1, 0, -1. I would like to find any path (or say that such path doesn't exist) from one node to other (we can visit nodes many times)…
Kacper Kowalski
  • 321
  • 1
  • 4
21
votes
4 answers

A* Pathfinding in a hexagonal grid

Can anyone point me to a simple example that implements A* path-finding algorithm on a hexagonal grid (in JS). I have made it working on a square grid, however all my attempts to make it work on a hexagonal grid have failed. This is how my grid…
Alexus
  • 1,887
  • 1
  • 23
  • 50
21
votes
1 answer

How do you use a Bidirectional BFS to find the shortest path?

How do you use a Bidirectional BFS to find the shortest path? Let's say there is a 6x6 grid. The start point is in (0,5) and the end point is in (4,1). What is the shortest path using bidirectional bfs? There are no path costs. And it is undirected.
21
votes
7 answers

How do I have spaces in a MSBuild WebProjectOutputDir?

I am trying to call MSBuild from a command line. Everything was working fine when I was using a path that had no spaces, but now I have a path that has spaces and the command is failing. Command…
ChrisHDog
  • 4,473
  • 8
  • 51
  • 77
20
votes
1 answer

How to find the longest path in a graph with a set of start and target points?

I have a DAG (with costs/weights per edge) and want to find the longest path between two sets of nodes. The two sets of start and target nodes are disjoint and small in size compared to the total number of nodes in the graph. I know how to do this…
starmole
  • 4,974
  • 1
  • 28
  • 48
20
votes
6 answers

Pathfinding Algorithm For Pacman

I wanted to implement the game Pacman. For the AI, I was thinking of using the A* algorithm, having seen it on numerous forums. However, I implemented the Breadth First Search for some simple pathfinding (going from point a to point b with certain…
Karan
  • 11,509
  • 8
  • 34
  • 38
19
votes
1 answer

What is the point of IDA* vs A* algorithm

I don't understand how IDA* saves memory space. From how I understand IDA* is A* with iterative deepening. What's the difference between the amount of memory A* uses vs IDA*. Wouldn't the last iteration of IDA* behave exactly like A* and use the…
tcui222
  • 319
  • 2
  • 3
  • 10
18
votes
3 answers

Is A-star guaranteed to give the shortest path in a 2D grid

I am working with A-star algorithm, whereing I have a 2D grid and some obstacles. Now, I have only vertical and horizontal obstacles only, but they could vary densely. Now, the A-star works well (i.e. shortest path found for most cases), but if I…
Kraken
  • 23,393
  • 37
  • 102
  • 162
17
votes
6 answers

Map-Navigation Project, How is road data generally stored/represented?

Navigation systems like the Garmin and TomTom have always fascinated me. I've wanted to implement small map/navigation applications to try out various pathing algorithms and expand on my knowledge of them. This is a two part question: 1.) How is…
mmcdole
  • 91,488
  • 60
  • 186
  • 222