I need pathfinding in a project with only 4 directions. So I looked at the A* algorythm, and I tried to draw something to understand how it's going to work.
But I noticed that there are multiple paths that are the 'same' to get to my endpoint, my question is: How is the algorythm going to choose between all these paths that cost the same, and Isn't there a way to modify this algorythm to optimize it specifically for 4 directions and no diagonals?
Here's a little drawing of the result:
EDIT: basically what I think may suit my implementation, is to add a T value to each node which will represent the number of 'turns' needed from the starting node. With this, when checking adjacent nodes, if some of them have the same F value, move to the node with the lowest T value.
EDIT2: well it's a little trickier than that It might work if I assign a higher value for each turn and then calculate F = G + H + T