mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Fix a crash with depth 1 perft
Bug recently introduced in e215a88cdd
No functional change.
This commit is contained in:
parent
58aee9a9ea
commit
366f6b0dab
1 changed files with 5 additions and 2 deletions
|
@ -153,7 +153,7 @@ 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.
|
||||
|
||||
size_t Search::perft(Position& pos, Depth depth) {
|
||||
static size_t perft(Position& pos, Depth depth) {
|
||||
|
||||
StateInfo st;
|
||||
size_t cnt = 0;
|
||||
|
@ -163,12 +163,15 @@ size_t Search::perft(Position& pos, Depth depth) {
|
|||
for (MoveList<LEGAL> it(pos); *it; ++it)
|
||||
{
|
||||
pos.do_move(*it, st, ci, pos.move_gives_check(*it, ci));
|
||||
cnt += leaf ? MoveList<LEGAL>(pos).size() : perft(pos, depth - ONE_PLY);
|
||||
cnt += leaf ? MoveList<LEGAL>(pos).size() : ::perft(pos, depth - ONE_PLY);
|
||||
pos.undo_move(*it);
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
size_t Search::perft(Position& pos, Depth depth) {
|
||||
return depth > ONE_PLY ? ::perft(pos, depth) : MoveList<LEGAL>(pos).size();
|
||||
}
|
||||
|
||||
/// Search::think() is the external interface to Stockfish's search, and is
|
||||
/// called by the main thread when the program receives the UCI 'go' command. It
|
||||
|
|
Loading…
Add table
Reference in a new issue