Exemplo n.º 1
0
    public int CompareTo(Node other)
    {
        if (other == null)
        {
            return(1);
        }

        return(FCost.CompareTo(other.FCost));
    }
Exemplo n.º 2
0
 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
 }
Exemplo n.º 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.
    }
Exemplo n.º 4
0
        public int CompareTo(Node nodeToCompare)
        {
            int compare = FCost.CompareTo(nodeToCompare.FCost);

            if (compare == 0)
            {
                compare = HCost.CompareTo(nodeToCompare.HCost);
            }
            return(-compare);
        }
Exemplo n.º 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);
    }
Exemplo n.º 6
0
    public int CompareTo(Node NodeToCompare)
    {
        int Compare = FCost.CompareTo(NodeToCompare.FCost);

        if (Compare == 0)
        {
            Compare = HCost.CompareTo(NodeToCompare.HCost);
        }
        return(-Compare);
    }
Exemplo n.º 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);
    }
Exemplo n.º 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);
    }
Exemplo n.º 9
0
        public int CompareTo(Node node)
        {
            int comp = FCost.CompareTo(node.FCost);

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

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

            if (compare == 0)
            {
                compare = HCost.CompareTo(other.HCost);
            }
            return(-compare);
        }
Exemplo n.º 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);
    }
Exemplo n.º 14
0
        public int CompareTo(INode other)
        {
            int fCostCompare = -FCost.CompareTo(other.FCost);

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

            return(fCostCompare);
        }
Exemplo n.º 15
0
    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);
    }
Exemplo n.º 16
0
        public int CompareTo(object obj)
        {
            Node Node2 = obj as Node;

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

            return(FCost.CompareTo(Node2.FCost));
        }
Exemplo n.º 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!!!
        }
Exemplo n.º 18
0
    public override int CompareTo(Node other)
    {
        int compare = FCost.CompareTo(other.FCost);

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

        return(-compare);
    }
Exemplo n.º 19
0
    public int CompareTo(Node node)
    {
        int compare = FCost.CompareTo(node.FCost);

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

        return(-compare);
    }
Exemplo n.º 20
0
    public int CompareTo(AbstractAStarNode other)
    {
        int compare = FCost.CompareTo(other.FCost);

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

        return(compare);
    }
Exemplo n.º 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);
    }
Exemplo n.º 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));
        }
Exemplo n.º 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);
    }
Exemplo n.º 24
0
        public int CompareTo(GridNodeAStar other)
        {
            var compare = FCost.CompareTo(other.FCost);

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

            return(-compare);
        }
Exemplo n.º 25
0
    public int CompareTo(GridTile other)
    {
        int compare = FCost.CompareTo(other.FCost);

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

        return(-compare);
    }
Exemplo n.º 26
0
        public int CompareTo(Node other)
        {
            int compare = FCost.CompareTo(other.FCost);

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

            return(-compare);
        }
Exemplo n.º 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);
    }
Exemplo n.º 28
0
    public int CompareTo(Node other)
    {
        var comparison = FCost.CompareTo(other.FCost);

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

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

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

        return(-compare);
    }
Exemplo n.º 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);
        }