A* path finding algorithm minimizing turns

Hi Everyone, I followed the tutorial of the coding train regarding the A* path finding algorithm, it is very useful for one of my project, I tried to modify it to minimize the number of turns. When it calculates the f score, if the next step requires a change of direction I add a small value (0.2). This mod improved the situation reducing the number of turns in the shortest path. But it does not guarantee that it is always the minimum number of turns, sometimes it misses the best solution.

Do you have any suggestion?

Answers

Sign In or Register to comment.