protected void Think(Color playerToMove)
        {
            PrincipalVariation = new PrincipalVariation(Board.BoardSize);

            FollowPV = true;
            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;
                FollowPV       = 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(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;
                }
            }
        }
Exemple #2
0
        protected void Think(Color playerToMove)
        {
            PrincipalVariation = new PrincipalVariation(Board.BoardSize);

            int lBestValue = Search(playerToMove, SearchOptions.MaxPly, 0, -10000, 10000);

            SearchStatus.BestMove        = PrincipalVariation.BestMove;
            SearchStatus.BestValue       = lBestValue;
            SearchStatus.CurrentPly      = SearchOptions.MaxPly;
            SearchStatus.MaxPly          = SearchOptions.MaxPly;
            SearchStatus.PercentComplete = 100;

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

            int lBestValue = Search(playerToMove, SearchOptions.MaxPly, 0, -10000, 10000);

            SearchStatus.BestMove = PrincipalVariation.BestMove;
            SearchStatus.BestValue = lBestValue;
            SearchStatus.CurrentPly = SearchOptions.MaxPly;
            SearchStatus.MaxPly = SearchOptions.MaxPly;
            SearchStatus.PercentComplete = 100;

            UpdateStatus();
        }