protected AbstractBoard.Player opponentPiece; // the opponents piece public Node(AbstractBoard b, Node parent, Space move) { this.board = b.Clone(); this.parent = parent; this.move = move; if (parent != null) myPiece = AbstractBoard.GetOponentPiece(parent.myPiece); children = new List<Node>(); }
public void SelectBestMove() { // if no children there is no best move for the node if (children.Count == 0) { bestMoveNode = null; return; } // sort the children so that the first element contains the 'best' node List<Node> sortedChildren = SortChildren(this.children); this.bestMoveNode = sortedChildren[0]; Value = bestMoveNode.Value; }