1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Fix wrong reported depth

Interestingly this patch will make people complain search depth
is reduced against 2.0.1 ;-) but actually it is only an artifact.

Spotted by Joona.

No functional change apart from a different do / undo move
sequence due to teh fact that we don't call pv_info_to_uci()
anymore before entering id loop.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-02-12 17:39:48 +01:00
parent c006435bb4
commit aa84731fb9
3 changed files with 10 additions and 11 deletions

View file

@ -77,7 +77,7 @@ void benchmark(int argc, char* argv[]) {
ttSize = argc > 2 ? argv[2] : "128"; ttSize = argc > 2 ? argv[2] : "128";
threads = argc > 3 ? argv[3] : "1"; threads = argc > 3 ? argv[3] : "1";
valStr = argc > 4 ? argv[4] : "12"; valStr = argc > 4 ? argv[4] : "11";
posFile = argc > 5 ? argv[5] : "default"; posFile = argc > 5 ? argv[5] : "default";
valType = argc > 6 ? argv[6] : "depth"; valType = argc > 6 ? argv[6] : "depth";

View file

@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
{ {
if (string(argv[1]) != "bench" || argc > 7) if (string(argv[1]) != "bench" || argc > 7)
cout << "Usage: stockfish bench [hash size = 128] [threads = 1] " cout << "Usage: stockfish bench [hash size = 128] [threads = 1] "
<< "[limit = 12] [fen positions file = default] " << "[limit = 11] [fen positions file = default] "
<< "[depth, time, perft or node limited = depth]" << endl; << "[depth, time, perft or node limited = depth]" << endl;
else else
benchmark(argc, argv); benchmark(argc, argv);

View file

@ -633,24 +633,22 @@ namespace {
return MOVE_NONE; return MOVE_NONE;
} }
// Send initial scoring (iteration 1)
cout << set960(pos.is_chess960()) // Is enough to set once at the beginning
<< "info depth " << iteration
<< "\n" << Rml[0].pv_info_to_uci(pos, ONE_PLY, alpha, beta) << endl;
// Is one move significantly better than others after initial scoring ? // Is one move significantly better than others after initial scoring ?
if ( Rml.size() == 1 if ( Rml.size() == 1
|| Rml[0].pv_score > Rml[1].pv_score + EasyMoveMargin) || Rml[0].pv_score > Rml[1].pv_score + EasyMoveMargin)
easyMove = Rml[0].pv[0]; easyMove = Rml[0].pv[0];
// Iterative deepening loop // Iterative deepening loop
while (++iteration <= PLY_MAX && (!MaxDepth || iteration <= MaxDepth) && !StopRequest) while (++iteration <= PLY_MAX && !StopRequest)
{ {
cout << "info depth " << iteration << endl;
Rml.bestMoveChanges = researchCountFL = researchCountFH = 0; Rml.bestMoveChanges = researchCountFL = researchCountFH = 0;
depth = (iteration - 1) * ONE_PLY; depth = (iteration - 1) * ONE_PLY;
if (MaxDepth && depth > MaxDepth * ONE_PLY)
break;
cout << "info depth " << depth / ONE_PLY << endl;
// Calculate dynamic aspiration window based on previous iterations // Calculate dynamic aspiration window based on previous iterations
if (MultiPV == 1 && iteration >= 6 && abs(bestValues[iteration - 1]) < VALUE_KNOWN_WIN) if (MultiPV == 1 && iteration >= 6 && abs(bestValues[iteration - 1]) < VALUE_KNOWN_WIN)
{ {
@ -675,8 +673,9 @@ namespace {
// relevant entries have been overwritten during the search. // relevant entries have been overwritten during the search.
for (int i = 0; i < Min(MultiPV, (int)Rml.size()); i++) for (int i = 0; i < Min(MultiPV, (int)Rml.size()); i++)
{ {
cout << Rml[i].pv_info_to_uci(pos, depth, alpha, beta, i) << endl;
Rml[i].insert_pv_in_tt(pos); Rml[i].insert_pv_in_tt(pos);
cout << set960(pos.is_chess960())
<< Rml[i].pv_info_to_uci(pos, depth, alpha, beta, i) << endl;
} }
// Value cannot be trusted. Break out immediately! // Value cannot be trusted. Break out immediately!