Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        protected void Think(Color playerToMove)
        {
            TranspositionTableHits = 0;
            int lBestValue = 0;

            if (SearchOptions.IncludeEndGameMoves)
            {
                TranspositionTable = TranspositionTableEndGame;
            }
            else
            {
                TranspositionTable = TranspositionTablePrimary;
            }

            int lStart = (SearchOptions.StartPly <= SearchOptions.MaxPly) ? SearchOptions.StartPly : SearchOptions.MaxPly;

            if (lStart <= 0)
            {
                lStart = 1;
            }

            for (int lDepth = lStart; lDepth <= SearchOptions.MaxPly; lDepth++)
            {
                SearchComplete = true;
                lBestValue     = Search(playerToMove, lDepth, 0, -10000, 10000);
                Console.Error.WriteLine("+Ply: " + lDepth + " - " + SearchStatus.Timer.SecondsElapsed + " Seconds - Nodes/TT Hits: " + NodesSearched.ToString() + "/" + TranspositionTableHits.ToString() + " - Best: " + Board.Coord.ToString(BestMove) + " (" + lBestValue + ")");

                SearchStatus.UpdateBestMove(BestMove, lBestValue);
                SearchStatus.CurrentPly      = lDepth;
                SearchStatus.MaxPly          = lDepth;
                SearchStatus.PercentComplete = (lDepth / SearchOptions.MaxPly) * 100;

                UpdateStatus();

                if (StopThinkingFlag)
                {
                    break;
                }

                if (SearchComplete)
                {
                    Console.Error.WriteLine("Ply: " + lDepth + " - Search Completed!");
                    break;
                }
            }

            NagCoordinator.StopAll();
        }
        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;
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        protected void Think(Color playerToMove)
        {
            TranspositionTableHits = 0;
            int lBestValue = 0;

            if (SearchOptions.IncludeEndGameMoves)
                TranspositionTable = TranspositionTableEndGame;
            else
                TranspositionTable = TranspositionTablePrimary;

            int lStart = (SearchOptions.StartPly <= SearchOptions.MaxPly) ? SearchOptions.StartPly : SearchOptions.MaxPly;

            if (lStart <= 0)
                lStart = 1;

            for (int lDepth = lStart; lDepth <= SearchOptions.MaxPly; lDepth++)
            {
                SearchComplete = true;
                lBestValue = Search(playerToMove, lDepth, 0, -10000, 10000);
                Console.Error.WriteLine("+Ply: " + lDepth + " - " + SearchStatus.Timer.SecondsElapsed + " Seconds - Nodes/TT Hits: " + NodesSearched.ToString() + "/" + TranspositionTableHits.ToString() + " - Best: " + Board.Coord.ToString(BestMove) + " (" + lBestValue + ")");

                SearchStatus.UpdateBestMove(BestMove, lBestValue);
                SearchStatus.CurrentPly = lDepth;
                SearchStatus.MaxPly = lDepth;
                SearchStatus.PercentComplete = (lDepth / SearchOptions.MaxPly) * 100;

                UpdateStatus();

                if (StopThinkingFlag)
                    break;

                if (SearchComplete)
                {
                    Console.Error.WriteLine("Ply: " + lDepth + " - Search Completed!");
                    break;
                }
            }

            NagCoordinator.StopAll();
        }
Ejemplo n.º 6
0
        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;
        }