Exemple #1
0
    // Porovná hodnoty uzlů, přednost má ten, u kterého je součet vzdálenosti od počátku a odhadovaná vzdálenost od konce menší
    public int CompareTo(PathfindingNode other)
    {
        if (FCost == other.FCost)
        {
            return(GCost.CompareTo(other.GCost));
        }

        return(FCost.CompareTo(other.FCost));
    }
Exemple #2
0
    public int CompareTo(Cell other)
    {
        int result = FCost.CompareTo(other.FCost);

        if (result == 0)
        {
            result = GCost.CompareTo(other.GCost);
        }
        return(-result); //we need to return -result because higher F or G cost means that Cell has lower priority
    }
Exemple #3
0
        public int CompareTo(Node other)
        {
            int compare = FCost.CompareTo(other.FCost);

            if (compare == 0)
            {
                compare = HCost.CompareTo(other.HCost);
            }

            if (compare == 0)
            {
                compare = GCost.CompareTo(other.GCost);
            }

            return(-compare);
        }
Exemple #4
0
 public int CompareTo(DijkstraNode other)
 {
     return(-GCost.CompareTo(other.GCost));
 }