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; } } }
public new void Initialize(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, OnCompletion onCompletion) { base.Initialize(goBoard, playerToMove, searchOptions, onCompletion); if (TranspositionTable == null) { TranspositionTablePrimary = new TranspositionTable(SearchOptions.TranspositionTableSize); } else if (TranspositionTable.Size != SearchOptions.TranspositionTableSize) { TranspositionTablePrimary = new TranspositionTable(SearchOptions.TranspositionTableSize); } if (TranspositionTableEndGame == null) { TranspositionTableEndGame = new TranspositionTable(1024 * 1024); } TranspositionTable = TranspositionTablePrimary; }
public new void Initialize(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, OnCompletion onCompletion) { base.Initialize(goBoard, playerToMove, searchOptions, onCompletion); if (TranspositionTable == null) TranspositionTablePrimary = new TranspositionTable(SearchOptions.TranspositionTableSize); else if (TranspositionTable.Size != SearchOptions.TranspositionTableSize) TranspositionTablePrimary = new TranspositionTable(SearchOptions.TranspositionTableSize); if (TranspositionTableEndGame == null) TranspositionTableEndGame = new TranspositionTable(1024 * 1024); TranspositionTable = TranspositionTablePrimary; }
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; } } }