In computer science class at my university, our professor showed us an algorithm for finding a shortest path between two points on a grid with obstacles. Here is an implementation I made in C with a GUI.
It uses the SDL library for keyboard/mouse input and OpenGL for drawing.
The algorithm behind it is pretty fast; it finds solutions in less than a second, even on a 1000x1000 grid.
It supports reading from/writing to files in an ASCII-based format.
@Kinderlabor Thanks :)
Benedek93 3 months ago
@Benedek93 The algorithm is called "breadth-first search".
Kinderlabor 3 months ago
@Danny77uk No, I'm not sure if this algorithm has a name, our professor showed it to us. Actually, now that I looked into it, it's sort of like the "Sample algorithm" shown on the Wikipedia page on Pathfinding (look it up, apparently I cannot post links here).
Benedek93 3 months ago
A*?
Danny77uk 3 months ago
@rinsmaster Yeah, it does only look in 4 directions, but it should always find one of the shortest paths available :-)
Benedek93 3 months ago
Awesome! It's not the shortest path is it though? Well in Manhattan-distance it is I guess :) (compared to A* which creates semi diagonal lines)
But this is quite relevant to me, I was actually doing some research on path finding for my entry to Google's AI Challenge.
rinsmaster 3 months ago