/// <summary> /// Computes all children nodes of current node. /// </summary> /// <returns>Children nodes.</returns> private IReadOnlyList <ReversiNode> GetChildren() { var children = GetValidMoves(Player).Select(move => { ReversiTable table = GetTableForMove(move); ReversiTable stabilityTable = table.GetTableWithUpdatedStability(); return(new ReversiNode(stabilityTable, Opponent)); }).ToList(); // Check whether it is a terminal node or whether the current player passes. if (children.Count == 0 && canPass) { ReversiNode nextNode = new ReversiNode(stateTable, Opponent, false); if (nextNode.Children.Count > 0) { children.Add(nextNode); } } return(children.AsReadOnly()); }
/// <summary> /// Computes all children nodes of current node. /// </summary> /// <returns>Children nodes.</returns> private IReadOnlyList<ReversiNode> GetChildren() { var children = GetValidMoves(Player).Select(move => { ReversiTable table = GetTableForMove(move); ReversiTable stabilityTable = table.GetTableWithUpdatedStability(); return new ReversiNode(stabilityTable, Opponent); }).ToList(); // Check whether it is a terminal node or whether the current player passes. if (children.Count == 0 && canPass) { ReversiNode nextNode = new ReversiNode(stateTable, Opponent, false); if (nextNode.Children.Count > 0) { children.Add(nextNode); } } return children.AsReadOnly(); }