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 }; }
public bool CollectToPlayerSwitch(CompositeMove resultMove) { bool stopCollecting = false; _moves.TakeWhile(move => { stopCollecting = move.CollectToPlayerSwitch(resultMove); return stopCollecting == false; }).ToList(); return stopCollecting; }
public bool CollectToPlayerSwitch(CompositeMove resultMove) { bool stopCollecting = false; _moves.TakeWhile(move => { stopCollecting = move.CollectToPlayerSwitch(resultMove); return(stopCollecting == false); }).ToList(); return(stopCollecting); }
public bool CollectToPlayerSwitch(CompositeMove resultMove) { resultMove.Add(this); return(false); }
public bool CollectToPlayerSwitch(CompositeMove resultMove) { resultMove.Add(this); return false; }