Based on Dijkstra’s shortest path algorithm to find the shortest distance between two points in a grid