private static int CartesianHeuristic(AStarNode <string> a, AStarNode <string> b) { CartesianNode aCartesian = (CartesianNode)a; CartesianNode bCartesian = (CartesianNode)b; return(aCartesian.DistanceTo(bCartesian)); }
public int DistanceTo(CartesianNode other) { int dx = Math.Abs(this.x - other.x); int dy = Math.Abs(this.y - other.y); return((int)Math.Round(Math.Sqrt(Math.Pow(dx, 2.0) + Math.Pow(dy, 2.0)))); }
public List <string> FindPath(CartesianNode from, CartesianNode to) { return(astar.GetPath(from, to, CartesianHeuristic, CartesianHeuristic).Select(node => node.data).ToList()); }
public void AddNeighbour(CartesianNode other) { this.neighbours.Add(other); }