mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Speed up perft
There is no need to do / undo the move at the last ply No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
12461996a5
commit
483a257618
1 changed files with 8 additions and 3 deletions
|
@ -332,14 +332,19 @@ namespace {
|
||||||
|
|
||||||
int perft(Position& pos, Depth depth)
|
int perft(Position& pos, Depth depth)
|
||||||
{
|
{
|
||||||
if (depth <= Depth(0)) // Replace with '<' to test also qsearch
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
Move move;
|
Move move;
|
||||||
MovePicker mp = MovePicker(pos, MOVE_NONE, depth, H);
|
MovePicker mp = MovePicker(pos, MOVE_NONE, depth, H);
|
||||||
Bitboard dcCandidates = mp.discovered_check_candidates();
|
Bitboard dcCandidates = mp.discovered_check_candidates();
|
||||||
int sum = 0;
|
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
|
// Loop through all legal moves
|
||||||
while ((move = mp.get_next_move()) != MOVE_NONE)
|
while ((move = mp.get_next_move()) != MOVE_NONE)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue