コード例 #1
0
        public IEnumerator <IJumpNodeTreeWithFactory> GetEnumerator()
        {
            var whiteField = _parentJumpNode.ActualGraph.GetWhiteField();

            if (whiteField.IsWinningField(_parentJumpNode.ActualGraph.RowCount))
            {
                yield break;
            }

            foreach (var fieldToPlaceStoneAt in _placersFactory.CurrentPlayerPlaces(_blackStonePlacer()))
            {
                var newMove  = new PlaceBlackStoneMove(fieldToPlaceStoneAt);
                var jumpNode = _parentJumpNode.FollowedBy(newMove);
                yield return(new AlternatingJumpsMovesTree(jumpNode, _parent.ChildFactory));
            }
        }
コード例 #2
0
        public IEnumerator <IJumpNodeTreeWithFactory> GetEnumerator()
        {
            var actualGraph        = (IFieldsGraph)_parentJumpNode.ActualGraph.Clone();
            var localMovePerformer = PerformMoves.DontCareAboutPlayerStateChange(actualGraph);
            var current            = new RootedBySelectingWhiteFieldBoardJumpTree(actualGraph);
            var visitor            = new PerformMovesNodeVisitor(localMovePerformer).FollowedBy(_afterMoveVisitor);
            var currentMoves       = current.TraverseDfs(visitor, _alphaBetaOptions.JumpsMaxDepth)
                                     .Skip(_alphaBetaOptions.SkipShortMoves);

            foreach (var currentMove in currentMoves)
            {
                var newMove  = CreateNewMove(currentMove);
                var jumpNode = _parentJumpNode.FollowedBy(newMove);
                yield return(new AlternatingJumpsMovesTree(jumpNode, Parent.ChildFactory));
            }
        }