/// <summary> /// Clone this instance. /// </summary> /// <returns></returns> public SearchOptions Clone() { SearchOptions lSearchOptions = new SearchOptions(); lSearchOptions.MaxPly = MaxPly; lSearchOptions.MaxSeconds = MaxSeconds; lSearchOptions.SortMoves = SortMoves; lSearchOptions.IncludeEndGameMoves = IncludeEndGameMoves; lSearchOptions.EndGameMovesMaxPly = EndGameMovesMaxPly; lSearchOptions.CheckSuperKo = CheckSuperKo; lSearchOptions.EarlyTimeOut = EarlyTimeOut; lSearchOptions.EndGameMaxSeconds = EndGameMaxSeconds; lSearchOptions.PrunePassMove = PrunePassMove; lSearchOptions.UsePatterns = UsePatterns; lSearchOptions.StartPly = StartPly; lSearchOptions.SuperKo = SuperKo; lSearchOptions.ContinueThinkingAfterTimeOut = ContinueThinkingAfterTimeOut; lSearchOptions.PonderOnOpponentsTime = PonderOnOpponentsTime; lSearchOptions.TranspositionTableSize = TranspositionTableSize; lSearchOptions.PatternDetector = PatternDetector.Clone(); lSearchOptions.AlphaValue = AlphaValue; lSearchOptions.BetaValue = BetaValue; lSearchOptions.Permutations = Permutations; return lSearchOptions; }
public void Start(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, SearchMethodType searchMethodType, OnCompletion onCompletion) { // stop existing search, if any if (SearchInterface != null) Stop(); if (SearchMethodType != searchMethodType) { SearchMethodType = searchMethodType; SearchInterface = SearchMethodFactory.CreateFactory(searchMethodType); } // make a private copy of the board Board = goBoard.Clone(); // make a private copy of the search options SearchOptions = searchOptions.Clone(); // set player to move PlayerToMove = playerToMove; // set the Nag Coordinator SearchInterface.SetNagCoordinator(NagCoordinator); // initialize the search parameters SearchInterface.Initialize(Board, PlayerToMove, SearchOptions, onCompletion); // start search SearchThread = new Thread(this.StartThread); SearchThread.Start(); }
public new void Initialize(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, OnCompletion onCompletion) { base.Initialize(goBoard, playerToMove, searchOptions, onCompletion); if (TranspositionTable == null) TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize); else if (TranspositionTable.Size != SearchOptions.TranspositionTableSize) TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize); if (TranspositionTableEndGame == null) TranspositionTableEndGame = new TranspositionTablePlus(1024 * 1024); TranspositionTable = TranspositionTablePrimary; }
public void Initialize(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, OnCompletion onCompletion) { lock (this) { SearchStatus = new SearchStatus(); SearchStatus.BoardSize = goBoard.BoardSize; Status = SearchStatusType.Thinking; UpdateStatus(); UpdateStatusFlag = true; StopThinkingFlag = false; SearchOptions = searchOptions.Clone(); NodesSearched = NodesEvaluated = 0; CheckSuperKo = searchOptions.CheckSuperKo; OnCompletion = onCompletion; SearchInterface.Initialize(goBoard, SearchOptions); Board = goBoard; PlayerToMove = playerToMove; } }
public new void Initialize(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, OnCompletion onCompletion) { base.Initialize(goBoard, playerToMove, searchOptions, onCompletion); // setup distributed search coordinator & initialize workers if (NagCoordinator == null) NagCoordinator = new NagCoordinator(9999, SearchOptions.PatternDetector.Patterns); // default port NagCoordinator.SetNagCallBack(SetNag); NagCoordinator.Initialize(goBoard); if (TranspositionTable == null) TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize); else if (TranspositionTable.Size != SearchOptions.TranspositionTableSize) TranspositionTablePrimary = new TranspositionTablePlus(SearchOptions.TranspositionTableSize); if (TranspositionTableEndGame == null) TranspositionTableEndGame = new TranspositionTablePlus(1024 * 1024); TranspositionTable = TranspositionTablePrimary; }
/// <summary> /// Initializes the interface. /// </summary> /// <param name="goBoard">The Go board.</param> /// <param name="searchInstanceOptions">The search instance options.</param> public void Initialize(GoBoard goBoard, SearchOptions searchInstanceOptions) { Board = goBoard; Options = searchInstanceOptions; }