예제 #1
0
        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();
        }
예제 #2
0
파일: Search.cs 프로젝트: tgiphil/GoTraxx
        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();
        }