/// <summary> /// Evaluates this node in the decision tree. /// If the return value is true then move will contain the desired move (if any). /// </summary> /// <param name="state">The current state of the game.</param> /// <param name="move">If this node wants to make a move then it will be placed in this parameter.</param> /// <returns>Returns true if this node is satisfied and false otherwise.</returns> /// <remarks>Although move must be initialized, that does not mean it is not null.</remarks> protected internal override bool Evaluate(GameState <M> state, ref M move) { IEnumerable <Node <M> > chldrn = Children; InnerNode.RemoveAllChildren(); InnerNode.AddChildren(chldrn); return(InnerNode.Evaluate(state, ref move)); }
/// <summary> /// Removes all children from this node. /// </summary> public virtual void RemoveAllChildren() { if (InnerNode != null) { InnerNode.RemoveAllChildren(); } else if (!Terminal) { children.Clear(); } return; }