public PhutballMoveScore Search(IFieldsGraph fieldsGraph)
        {
            if(_alphaBetaSearchDepth.SearchDepth == 0)
            {
                return PhutballMoveScore.Empty();
            }
            var actualGraph = (IFieldsGraph)fieldsGraph.Clone();
            var performMoves = new PerformMoves(actualGraph, _playersState);
            var visitedNodes = new VisitedNodesCounter<JumpNode>();
            _alphaBetaSearch = new AlphaBetaSearch<JumpNode>(
                new WhiteStoneToCurrentPlayerBorderDistance(_playersState, actualGraph, _alphaBetaSearchDepth.DistanceToBorderWeight)
                .Add(new BlackStoneToTargetBorderCount(_playersState, actualGraph, _alphaBetaSearchDepth.BlackStonesToBorderWeight))
                ,
                _alphaBetaSearchDepth,
                new PerformMovesNodeVisitor(performMoves).FollowedBy(visitedNodes)
            );

            var movesTree = _movesFactory(actualGraph);
            _alphaBetaSearch.Run(movesTree);
            var result = new CompositeMove();
            _alphaBetaSearch.BestMove.Move.MovesFromRoot.CollectToPlayerSwitch(result);
            return new PhutballMoveScore(result, _alphaBetaSearch.BestMove.Score)
                       {
                           CuttoffsCount = _alphaBetaSearch.CuttoffsCount,
                           VisitedNodesCount = visitedNodes.Count
                       };
        }
示例#2
0
 public bool CollectToPlayerSwitch(CompositeMove resultMove)
 {
     bool stopCollecting = false;
     _moves.TakeWhile(move =>
                          {
                              stopCollecting = move.CollectToPlayerSwitch(resultMove);
                              return stopCollecting == false;
                          }).ToList();
     return stopCollecting;
 }
示例#3
0
        public bool CollectToPlayerSwitch(CompositeMove resultMove)
        {
            bool stopCollecting = false;

            _moves.TakeWhile(move =>
            {
                stopCollecting = move.CollectToPlayerSwitch(resultMove);
                return(stopCollecting == false);
            }).ToList();
            return(stopCollecting);
        }
示例#4
0
 public bool CollectToPlayerSwitch(CompositeMove resultMove)
 {
     resultMove.Add(this);
     return(false);
 }
示例#5
0
 public bool CollectToPlayerSwitch(CompositeMove resultMove)
 {
     resultMove.Add(this);
     return false;
 }