Perft and insufficient material

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Perft and insufficient material

Post by Sven »

I would like to clarify an issue with the perft algorithm. It is well-known that perft ignores draw by repetition and draw by 50 moves rule. But what about the third common case, draw by insufficient material (e.g. KK, KNK, KBK)?

According to the basic rule that perft only counts leaf nodes at exactly the given target depth N, for positions where insufficient material can occur it does indeed make a difference whether such a draw position is recognized (and therefore not expanded further) or ignored (and therefore expanded, increasing the resulting leaf count).

At least the algorithm presented within the chess programming wiki does not take care of this draw case, so it counts more nodes. But it does not mention that this draw is ignored, too.

The Perft page of Roce offers a Perft test suite as an EPD file. The node counts contained there seem to ignore draw by insufficient material, too. My personal feeling is that one should *not* ignore it but more important than that is to know the official standard.

So which way is correct? If ignoring this draw is regarded as correct then some descriptions on the web should be updated accordingly. Maybe some engines are affected, too.

Sven
MattieShoes
Posts: 718
Joined: Fri Mar 20, 2009 8:59 pm

Re: Perft and insufficient material

Post by MattieShoes »

I always ignored all draw conditions. To be honest, it never occurred to me to even wonder whether others did the same.
User avatar
Roman Hartmann
Posts: 295
Joined: Wed Mar 08, 2006 8:29 pm

Re: Perft and insufficient material

Post by Roman Hartmann »

Hi Sven,
you're right that the condition 'insufficient material' seems nowhere to be mentioned on any page covering perft.
My understanding was alyways that that perft is only meant to test the validity of the move generation and the make and unmake process but is not intended to test the evaluation of an engine and therefore I just ignored all draw situations with the exception of stalemate.

best regards
Roman
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Perft and insufficient material

Post by Sven »

Roman Hartmann wrote:Hi Sven,
you're right that the condition 'insufficient material' seems nowhere to be mentioned on any page covering perft.
My understanding was alyways that that perft is only meant to test the validity of the move generation and the make and unmake process but is not intended to test the evaluation of an engine and therefore I just ignored all draw situations with the exception of stalemate.

best regards
Roman
It would be perfectly o.k. for me to ignore 'insufficient material', too, if this is widely accepted and documented. But all descriptions I have read only mention that repetion and 50 moves are ignored, so why is the third condition not mentioned?

Also I think that 'draw by insufficient material' is not really an evaluation issue, it belongs to the chess rules. Deviations from the rules for a special purpose should be stated explicitly, that's all I want to achieve.

Sven