Beispiel #1
0
    public int CompareTo(Node other)
    {
        if (other == null)
        {
            return(1);
        }

        return(FCost.CompareTo(other.FCost));
    }
 public int CompareTo(Node other)
 {
     _priorityCache = FCost.CompareTo(other.FCost);  // A* first comparison F Cost
     if (_priorityCache == 0)
     {
         _priorityCache = HCost.CompareTo(other.HCost);
     }
     return(-_priorityCache); // Negative since the 1 meaning that the cost has a higher integer value and we are trying to find the lower cost
 }
Beispiel #3
0
    public int CompareTo(Node nodeToCompare)                 //Compare two nodes.
    {
        int compare = FCost.CompareTo(nodeToCompare.FCost);  //compare is equal to this nodes fCost compared to the nodeToCompares fCost.

        if (compare == 0)                                    //The fCost values are the same.
        {
            compare = hCost.CompareTo(nodeToCompare.hCost);  //Compare the hCost values as a tie breaker.
        }
        return(-compare);                                    //Return the inverted value of compare.
    }
Beispiel #4
0
        public int CompareTo(Node nodeToCompare)
        {
            int compare = FCost.CompareTo(nodeToCompare.FCost);

            if (compare == 0)
            {
                compare = HCost.CompareTo(nodeToCompare.HCost);
            }
            return(-compare);
        }
Beispiel #5
0
    public int CompareTo(PathNode nodeToCompare)
    {
        int compare = FCost.CompareTo(nodeToCompare.FCost);

        if (compare == 0)         // Distance to goal is tiebreaker
        {
            compare = hCost.CompareTo(nodeToCompare.hCost);
        }
        return(-compare);
    }
Beispiel #6
0
    public int CompareTo(Node NodeToCompare)
    {
        int Compare = FCost.CompareTo(NodeToCompare.FCost);

        if (Compare == 0)
        {
            Compare = HCost.CompareTo(NodeToCompare.HCost);
        }
        return(-Compare);
    }
Beispiel #7
0
    public int CompareTo(Node _node)
    {
        int compare = FCost.CompareTo(_node.FCost);

        if (compare == 0)   //if both have the same F cost then compare H cost of the two
        {
            compare = hCost.CompareTo(_node.hCost);
        }
        return(-compare);
    }
Beispiel #8
0
    public int CompareTo(PathNode nodeToCompare)
    {
        int compare = FCost.CompareTo(nodeToCompare.FCost);

        if (compare == 0) // 2 fcost are equal.
        {
            compare = HCost.CompareTo(nodeToCompare.HCost);
        }
        return(-compare);
    }
Beispiel #9
0
        public int CompareTo(Node node)
        {
            int comp = FCost.CompareTo(node.FCost);

            if (comp == 0)
            {
                comp = hCost.CompareTo(node.hCost);
            }
            return(~comp);
        }
Beispiel #10
0
    public int CompareTo(Node node)
    {
        int compareCost = FCost.CompareTo(node.FCost);

        if (compareCost == 0)
        {
            compareCost = hCost.CompareTo(node.hCost);
        }
        return(-compareCost);
    }
Beispiel #11
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
    }
Beispiel #12
0
        public int CompareTo(AstarNode other)
        {
            var compare = FCost.CompareTo(other.FCost);

            if (compare == 0)
            {
                compare = HCost.CompareTo(other.HCost);
            }
            return(-compare);
        }
Beispiel #13
0
    public int CompareTo(Node other) //using inverse of built in int compare based on code given for compare to result
    {
        int compare = FCost.CompareTo(other.FCost);

        if (compare == 0)
        {
            compare = hCost.CompareTo(other.hCost);
        }
        return(-compare);
    }
Beispiel #14
0
        public int CompareTo(INode other)
        {
            int fCostCompare = -FCost.CompareTo(other.FCost);

            if (fCostCompare == 0)
            {
                return(-HCost.CompareTo(other.HCost));
            }

            return(fCostCompare);
        }
    public int CompareTo(PathNode other)
    {
        int compare = FCost.CompareTo(other.FCost);

        if (compare == 0)
        {
            compare = HCost.CompareTo(other.HCost); //remember, hCost is the tiebreaker
        }
        //CompareTo on integers treats higher as better. Because this is a pathing algorithm, our problem instead is minimization. So therefore, we return _negative_ compare.
        return(-compare);
    }
Beispiel #16
0
        public int CompareTo(object obj)
        {
            Node Node2 = obj as Node;

            if (Node2 == null)
            {
                throw new Exception();
            }

            return(FCost.CompareTo(Node2.FCost));
        }
Beispiel #17
0
        public int CompareTo(Node nodeToCompare)
        {
            int compare = FCost.CompareTo(nodeToCompare.FCost);

            if (compare == 0)
            {
                compare = _hCost.CompareTo(nodeToCompare._hCost);
            }

            return(-compare); //lower, not higher!!!
        }
Beispiel #18
0
    public override int CompareTo(Node other)
    {
        int compare = FCost.CompareTo(other.FCost);

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

        return(-compare);
    }
Beispiel #19
0
    public int CompareTo(Node node)
    {
        int compare = FCost.CompareTo(node.FCost);

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

        return(-compare);
    }
    public int CompareTo(AbstractAStarNode other)
    {
        int compare = FCost.CompareTo(other.FCost);

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

        return(compare);
    }
Beispiel #21
0
    //odradi ovo preko delegata
    public int CompareTo(Field other)
    {
        int compare = FCost.CompareTo(other.FCost);

        if (compare == 0)
        {
            compare = HCost.CompareTo(other.HCost);
        }
        //1 curent item is lower priority
        return(-compare);
    }
Beispiel #22
0
        public int CompareTo(object obj)
        {
            var other = (Node)obj;

            if (other == null)
            {
                throw new ArgumentException("Object is not a Node.");
            }

            return(FCost.CompareTo(other.FCost));
        }
Beispiel #23
0
    public int CompareTo(Node nodeToCompare)
    {
        int compare = FCost.CompareTo(nodeToCompare.FCost);

        if (compare == 0)
        {
            compare = hCost.CompareTo(nodeToCompare.hCost);
        }
        // we return 1 if is lower
        return(-compare);
    }
Beispiel #24
0
        public int CompareTo(GridNodeAStar other)
        {
            var compare = FCost.CompareTo(other.FCost);

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

            return(-compare);
        }
Beispiel #25
0
    public int CompareTo(GridTile other)
    {
        int compare = FCost.CompareTo(other.FCost);

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

        return(-compare);
    }
Beispiel #26
0
        public int CompareTo(Node other)
        {
            int compare = FCost.CompareTo(other.FCost);

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

            return(-compare);
        }
Beispiel #27
0
    public int CompareTo(object obj)
    {
        int compare = FCost.CompareTo((obj as Node).FCost);

        if (compare == 0)
        {
            compare = HCost.CompareTo((obj as Node).HCost);
        }

        return(-compare);
    }
Beispiel #28
0
    public int CompareTo(Node other)
    {
        var comparison = FCost.CompareTo(other.FCost);

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

        return(-comparison);
    }
Beispiel #29
0
    public int CompareTo(PathfindingNode other)
    {
        var compare = FCost.CompareTo(other.FCost);

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

        return(-compare);
    }
Beispiel #30
0
        public int CompareTo(PathfindingNode inNodeToCompare)
        {
            int compare = FCost.CompareTo(inNodeToCompare.FCost);

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

            // Flip the compare because we want to sort from lowest to highest.
            return(-compare);
        }