Esempio n. 1
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();
        }
Esempio n. 2
0
        protected void Think(Color playerToMove)
        {
            PrincipalVariation = new PrincipalVariation(Board.BoardSize);

            FollowPV = true;
            int lBestValue = 0;

            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;
                FollowPV       = true;
                lBestValue     = Search(playerToMove, lDepth, 0, -10000, 10000);
                Console.Error.WriteLine("Ply: " + lDepth + " - " + SearchStatus.Timer.SecondsElapsed + " Seconds - Nodes: " + NodesSearched.ToString() + " - Best: " + Board.Coord.ToString(PrincipalVariation.BestMove) + " (" + lBestValue + ")");

                SearchStatus.UpdateBestMove(PrincipalVariation.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;
                }
            }
        }