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 SearchOptions GetSearchOptions(Color playerColor) { SearchOptions lSearchOptions = SearchOptions.Clone(); int lMovesRemaining = SearchTimeEstimator.GetEstimatedMovesRemaining(Board.BoardSize, Board.MoveNbr); if (lSearchOptions.MaxSeconds == 0) { lSearchOptions.MaxSeconds = (int)SearchTimeEstimator.GetSearchTime(TimeLeft[playerColor.ToInteger()], lMovesRemaining); } if (lSearchOptions.MaxPly == 0) { lSearchOptions.MaxPly = 4; } return(lSearchOptions); }
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 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 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(); }