X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=c323de5d48f35a62d00e56552449c1255f946f4e;hp=3e4341c09031a73e2310a9b1b2e11044ce46beda;hb=53c2bf069752d9d15d1678d79b0490b33ef240b4;hpb=fa49311b362a1ab6e4bd5263c7782b19fa59c41f diff --git a/src/search.cpp b/src/search.cpp index 3e4341c0..c323de5d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -332,14 +332,19 @@ namespace { int perft(Position& pos, Depth depth) { - if (depth <= Depth(0)) // Replace with '<' to test also qsearch - return 1; - Move move; MovePicker mp = MovePicker(pos, MOVE_NONE, depth, H); Bitboard dcCandidates = mp.discovered_check_candidates(); int sum = 0; + // If we are at the last ply we don't need to do and undo + // the moves, just to count them. + if (depth <= OnePly) // Replace with '<' to test also qsearch + { + while ((move = mp.get_next_move()) != MOVE_NONE) sum++; + return sum; + } + // Loop through all legal moves while ((move = mp.get_next_move()) != MOVE_NONE) {