ruby implementation of the A* shortest path to solve parsed maze