No standard specification for Perft

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: No standard specification for Perft

Post by Michael Sherwin »

lucasart wrote: Sat Apr 20, 2019 9:25 am
Michael Sherwin wrote: Sat Apr 20, 2019 6:26 am
lucasart wrote: Sat Apr 20, 2019 3:46 am
Michael Sherwin wrote: Sat Apr 20, 2019 12:43 am
hgm wrote: Fri Apr 19, 2019 10:47 pm If you want perft to be a representative measure of the speed of an engine it should indeed focus more on capture-only generation. Perthaps it would be useful to define a function perft(N, M) which does N ply of full-width search followed by M ply of captures only.

Most people use perft only for testing correctness, however, to see if they get the right numbers.
And it would be useful to have an accurate count of the capture only nodes as well.
why?

perft is not a goal in itself. playing chess is the goal (or variants if that's your thing).

the only purpose of perft is to serve as unit test for the move generation (and move play/undo etc.).

in which valid use case do you need perft captures, that can't be verified by normal perft?
If an engine has a separate capture generator it might be good to see if the engine produces correct node counts there as well. And like HGM said it would be a way of testing engine performance minus eval more realistically.
Well, you must be doing it wrong, if you need to duplicate movegen code like this… Fix that instead of blaming perft.
-. --- - / .-- --- .-. - .... / .-. . ... .--. --- -. -.. .. -. --. / - --- ---
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: No standard specification for Perft

Post by Joost Buijs »

mar wrote: Sat Apr 20, 2019 1:49 pm
Joost Buijs wrote: Sat Apr 20, 2019 1:04 pm in my regular search I never promote to bishop because that is clearly a waste of time.
Is this really worth it? I always consider all legal moves in search and never even considered doing anything like that. Besides there are other ways to avoid wasting time on bishop underpromotions rather than completely pruning them.
There is a really really tiny fraction of games where it could matter, of course nothing that can be reliably measured.
And for analysis of course (but true, nobody would use my engine for analysis anyway :)
Testing with self-play shows that it helps my engine a tiny bit. I only do ALL under-promotions at the root.

Indeed there are positions where under-promotion to bishop secures the win, like this one:

[d]kb6/2P5/K7/2N5/8/8/8/8 w - -

These are very scarce and will probably never happen during normal play. I never found anything counter productive by not generating promotions to bishop. Of course it could be different for other engines.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: No standard specification for Perft

Post by elcabesa »

In my engine I use perft and divide to test the correctness of the engine.
Whit this goal, I use the same move generator, do/undo move routines and the move selector. I tested my engine in a lot of random positions and checked the result against stockfish. This helped me validating the code.
Sometimes I used it to check the speed, but this is not the goal of my routine.