Pathfinding algorithm AStar. Source code for the tutorial on site flashake.сom (in Russian).