示例#1
0
 public AllAlternatigJumpsTreeCollection(IJumpNodeTreeWithFactory parent, IAlphaBetaOptions alphaBetaOptions, ISearchNodeVisitor <JumpNode> afterMoveVisitor)
 {
     _alphaBetaOptions = alphaBetaOptions;
     _afterMoveVisitor = afterMoveVisitor;
     Parent            = parent;
     _parentJumpNode   = Parent.Node;
 }
示例#2
0
 public AlphaBetaSearch(IValueOf <T> valuer, IAlphaBetaOptions maxDepth, ISearchNodeVisitor <T> nodeVisitor)
 {
     _valuer       = valuer;
     _maxDepth     = maxDepth.SearchDepth;
     _depthCounter = new DepthCounterNodeVisitor <T>();
     _nodeVisitor  = _depthCounter.FollowedBy(nodeVisitor);
 }
示例#3
0
 public BruteForceMoveFindingStartegy(ISearchNodeVisitor <JumpNode> defaultNodeVistor,
                                      Func <ISearchNodeVisitor <JumpNode>, IPerformMoves, TargetBorder, ITreeSearch <JumpNode> > searchFactory,
                                      IPlayersState playersState,
                                      MovesFactory movesFactory)
 {
     _defaultNodeVistor = defaultNodeVistor;
     _movesFactory      = movesFactory;
     _searchFactory     = searchFactory;
     _playersState      = playersState;
 }
 public BruteForceMoveFindingStartegy(ISearchNodeVisitor<JumpNode> defaultNodeVistor, 
     Func<ISearchNodeVisitor<JumpNode>, IPerformMoves, TargetBorder,ITreeSearch<JumpNode>> searchFactory,
     IPlayersState playersState,
     MovesFactory movesFactory)
 {
     _defaultNodeVistor = defaultNodeVistor;
     _movesFactory = movesFactory;
     _searchFactory = searchFactory;
     _playersState = playersState;
 }
示例#5
0
 public BruteForceMoveFindingStartegy(
     ISearchNodeVisitor <JumpNode> defaultNodeVistor,
     Func <ISearchNodeVisitor <JumpNode>, ITreeSearch <JumpNode> > searchFactory,
     IPlayersState playersState,
     MovesFactory movesFactory)
 {
     _defaultNodeVistor = defaultNodeVistor;
     _movesFactory      = movesFactory;
     _searchFactory     = (visotors, perfomer, target) => searchFactory(visotors);
     _playersState      = playersState;
 }
 public BruteForceMoveFindingStartegy(
     ISearchNodeVisitor<JumpNode> defaultNodeVistor,
     Func<ISearchNodeVisitor<JumpNode>,ITreeSearch<JumpNode>> searchFactory,
     IPlayersState playersState,
     MovesFactory movesFactory)
 {
     _defaultNodeVistor = defaultNodeVistor;
     _movesFactory = movesFactory;
     _searchFactory = (visotors,perfomer, target) => searchFactory(visotors);
     _playersState = playersState;
 }
示例#7
0
 public CuttoffsMoveFindingStrategy(
     ISearchNodeVisitor <JumpNode> defaultNodeVistor,
     Func <ISearchNodeVisitor <JumpNode>, IPerformMoves, TargetBorder, ITreeSearch <JumpNode> > searchFactory,
     IPlayersState playersState,
     MovesFactory movesFactory)
 {
     _defaultNodeVistor = defaultNodeVistor;
     _movesFactory      = movesFactory;
     _searchFactory     = searchFactory;
     _playersState      = playersState;
     MaxVisitedNodes    = int.MaxValue;
 }
 public CuttoffsMoveFindingStrategy(
     ISearchNodeVisitor<JumpNode> defaultNodeVistor,
     Func<ISearchNodeVisitor<JumpNode>, IPerformMoves, TargetBorder,ITreeSearch<JumpNode>> searchFactory,
     IPlayersState playersState,
     MovesFactory movesFactory)
 {
     _defaultNodeVistor = defaultNodeVistor;
     _movesFactory = movesFactory;
     _searchFactory = searchFactory;
     _playersState = playersState;
     MaxVisitedNodes = int.MaxValue;
 }
示例#9
0
        public static IEnumerable <ITree <T> > TraverseDfs <T>(this ITree <T> tree, ISearchNodeVisitor <T> visitor, int depth)
        {
            if (depth == 0)
            {
                yield break;
            }
            visitor.OnEnter(tree, null);
            yield return(tree);

            foreach (var child in tree.Children.SelectMany(child => child.TraverseDfs(visitor, depth - 1)))
            {
                yield return(child);
            }
            visitor.OnLeave(tree, null);
        }
示例#10
0
 public CompisiteSearchNodeVisitor(ISearchNodeVisitor <TNode> first, ISearchNodeVisitor <TNode> second)
 {
     _first  = first;
     _second = second;
 }
示例#11
0
 public BfsSearch(ISearchNodeVisitor <TNode> nodeVisitor, IAddRemoveCollection <ITree <TNode> > toVisit)
 {
     _nodeVisitor = nodeVisitor;
     _toVisit     = toVisit;
 }
示例#12
0
 public BfsSearch(ISearchNodeVisitor <TNode> nodeVisitor) : this(nodeVisitor, new QueueAddRemoveCollection <ITree <TNode> >())
 {
 }
示例#13
0
 public DfsSearch(ISearchNodeVisitor <TNode> nodeVisitor)
 {
     _nodeVisitor = nodeVisitor;
 }
示例#14
0
 public static ISearchNodeVisitor <TNode> FollowedBy <TNode>(this ISearchNodeVisitor <TNode> left, ISearchNodeVisitor <TNode> right)
 {
     return(new CompisiteSearchNodeVisitor <TNode>(left, right));
 }
示例#15
0
 public static IEnumerable <ITree <T> > TraverseDfs <T>(this ITree <T> tree, ISearchNodeVisitor <T> visitor)
 {
     return(tree.TraverseDfs(visitor, int.MaxValue));
 }