X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=a3ad7be13147b4cce2fb8e6d9cea2f2cd1c24045;hp=8f1964dd6e9f8b426fc03a2189f30a068de6b7dc;hb=4b19430103ac75b574a6b269db447d359814b603;hpb=7c1f8dbde93267c7958a4de5e167a43e38c9e1e9 diff --git a/src/search.cpp b/src/search.cpp index 8f1964dd..a3ad7be1 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -198,24 +198,23 @@ void Search::init() { /// Search::perft() is our utility to verify move generation. All the leaf nodes /// up to the given depth are generated and counted and the sum returned. -int64_t Search::perft(Position& pos, Depth depth) { +size_t Search::perft(Position& pos, Depth depth) { - StateInfo st; - int64_t cnt = 0; - - MoveList ml(pos); - - // At the last ply just return the number of moves (leaf nodes) + // At the last ply just return the number of legal moves (leaf nodes) if (depth == ONE_PLY) - return ml.size(); + return MoveList(pos).size(); + StateInfo st; + size_t cnt = 0; CheckInfo ci(pos); - for ( ; !ml.end(); ++ml) + + for (MoveList ml(pos); !ml.end(); ++ml) { pos.do_move(ml.move(), st, ci, pos.move_gives_check(ml.move(), ci)); cnt += perft(pos, depth - ONE_PLY); pos.undo_move(ml.move()); } + return cnt; } @@ -1541,7 +1540,7 @@ split_point_start: // At split points actual search starts from here int t = SearchTime.elapsed(); int selDepth = 0; - for (int i = 0; i < Threads.size(); i++) + for (size_t i = 0; i < Threads.size(); i++) if (Threads[i].maxPly > selDepth) selDepth = Threads[i].maxPly;