Exemplo n.º 1
0
 public Search(SearchParameters p, Player searchingPlayer, SearchResults searchResults, Game game)
 {
     _p = p;
       _searchResults = searchResults;
       _game = game;
       _root = new InnerResult(_game.CalculateHash(), searchingPlayer.IsMax, 0);
 }
Exemplo n.º 2
0
        public SearchWorker(Search search, InnerResult rootResult, Game game, SearchResults searchResults)
        {
            _game = game;

              _search = search;
              _searchResults = searchResults;
              _parentResult = new Trackable<InnerResult>(rootResult).Initialize(game.ChangeTracker);
              _moveIndex.Initialize(game.ChangeTracker);
        }
Exemplo n.º 3
0
    private int StartNewSearch(ISearchNode searchNode, SearchResults cachedResults)
    {
      AdjustPerformance();
      ClearResultCache();

      var parameters = new SearchParameters(CurrentDepth, CurrentTargetCount,
        _searchParameters.SearchPartitioningStrategy);

      CurrentSearch = new Search(parameters,
        searchNode.Controller, cachedResults, _game);

      SearchStarted(this, EventArgs.Empty);

      _game.Publish(new SearchStartedEvent(_searchParameters));
      _nodeCount = 0;

      using (new SearchMonitor(this))
      {
        LastSearchStatistics = CurrentSearch.Start(searchNode);
      }

      var result = CurrentSearch.Result;

      LastSearchStatistics.NodeCount = _nodeCount;
      UpdateSearchDurations();

      _game.Publish(new SearchFinishedEvent());
      SearchFinished(this, EventArgs.Empty);

      CurrentSearch = null;
      return result;
    }