Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Node"/> class.
 /// </summary>
 /// <param name="state">The state.</param>
 public Node(IState state)
 {
     State          = state;
     Parent         = null;
     Successor      = null;
     Cost           = 0;
     Depth          = 0;
     Path           = false;
     Children       = new List <Node>();
     _stateComparer = new StateComparer();
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Node"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="successor">The successor.</param>
 public Node(Node parent, ISuccessor successor)
 {
     State          = successor.State;
     Parent         = parent;
     Successor      = successor;
     Cost           = parent.Cost + successor.Cost;
     Depth          = parent.Depth + 1;
     Path           = false;
     Children       = new List <Node>();
     _stateComparer = new StateComparer();
 }
Esempio n. 3
0
 /// <summary>
 /// Determines the sort order of the current state relative to the specified state.
 /// </summary>
 /// <param name="obj">State to compare.</param>
 /// <returns></returns>
 public virtual int CompareTo(object obj)
 {
     return(StateComparer.Compare(this, obj as IState));
 }