public static int ShortestDistance(this PM_Maze maze, Vec2i root, Vec2i destination) { if (maze.BoundingRect().Contains(root) == false) { throw new SystemException("root not contained in maze"); } if (maze.BoundingRect().Contains(root) == false) { throw new SystemException("destination not contained in maze"); } if (root == destination) { return(0); } List <Vec2i> shortestPath = maze.BFS_ShortestPath(root, destination); return(shortestPath.Count - 1); }