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); }
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; }