My engine failed some perft test.
I visited sites that explain perft but there was no explicit mention about under promotion. Since it is legal to have 4 promote types, I assume there would be 4 moves per promotion for perft.
Is it correct?
Thanks
Rasjid
Does perft include underpromotion?
Moderator: Ras
-
- Posts: 588
- Joined: Thu Mar 09, 2006 4:47 pm
- Location: Singapore
-
- Posts: 161
- Joined: Thu Jan 08, 2009 9:06 pm
- Location: San Francisco, USA
Re: Does perft include underpromotion?
Hi,
Yes, perft includes underpromotions since those are legal moves too.
Regards,
Vlad.
Yes, perft includes underpromotions since those are legal moves too.
Regards,
Vlad.
-
- Posts: 588
- Joined: Thu Mar 09, 2006 4:47 pm
- Location: Singapore
Re: Does perft include underpromotion?
Thanks.vladstamate wrote:Hi,
Yes, perft includes underpromotions since those are legal moves too.
Regards,
Vlad.
Now's the problem - trickest of part to seek needle in a haystack or under the ocean floor.
Rasjid
-
- Posts: 6401
- Joined: Thu Mar 09, 2006 8:30 pm
- Location: Chicago, Illinois, USA
Re: Does perft include underpromotion?
Use perftdiv to find the needleChan Rasjid wrote:Thanks.vladstamate wrote:Hi,
Yes, perft includes underpromotions since those are legal moves too.
Regards,
Vlad.
Now's the problem - trickest of part to seek needle in a haystack or under the ocean floor.
Rasjid
Miguel
-
- Posts: 588
- Joined: Thu Mar 09, 2006 4:47 pm
- Location: Singapore
Re: Does perft include underpromotion?
[d]8/7p/p5pb/4k3/P1pPn3/8/P5PP/1rB2RK1 b - d3 0 28
I hope the diagram shows.
Perft(6) = 38633283
//ok crafty - 38633283
My perft fails in this position. Just may be someone is familiar with this test given by a site "Sharper" and have some hints of likely move generation errors.
My perft:-
perft 1 4, nps(0)
perft 2 94, nps(0)
perft 3 2669, nps(2869000)
perft 4 54726, nps(1509050)
perft 5 1539195, nps(2518313)
perft 6 31753730, nps(4667662)
Thanks,
Rasjid
I hope the diagram shows.
Perft(6) = 38633283
//ok crafty - 38633283
My perft fails in this position. Just may be someone is familiar with this test given by a site "Sharper" and have some hints of likely move generation errors.
My perft:-
perft 1 4, nps(0)
perft 2 94, nps(0)
perft 3 2669, nps(2869000)
perft 4 54726, nps(1509050)
perft 5 1539195, nps(2518313)
perft 6 31753730, nps(4667662)
Thanks,
Rasjid
-
- Posts: 588
- Joined: Thu Mar 09, 2006 4:47 pm
- Location: Singapore
Re: Does perft include underpromotion?
BTW your number of posts is 2292 and mine is 229.michiguel wrote:Use perftdiv to find the needleChan Rasjid wrote:Thanks.vladstamate wrote:Hi,
Yes, perft includes underpromotions since those are legal moves too.
Regards,
Vlad.
Now's the problem - trickest of part to seek needle in a haystack or under the ocean floor.
Rasjid
Miguel
This is real WORK

Rasjid
-
- Posts: 1404
- Joined: Wed Mar 08, 2006 10:15 pm
- Location: San Francisco, California
Re: Does perft include underpromotion?
Your needle is right at the top.
Perft 1 is wrong, because there are five legal moves (not four, as shown by your output). You probably aren't counting the en passant capture at d3, which is part of the FEN.
jm

Perft 1 is wrong, because there are five legal moves (not four, as shown by your output). You probably aren't counting the en passant capture at d3, which is part of the FEN.
jm
-
- Posts: 1404
- Joined: Wed Mar 08, 2006 10:15 pm
- Location: San Francisco, California
Re: Does perft include underpromotion?
And just to verify, I made a version of my engine that doesn't generate en passant captures, and my perft 1 through perft 5 agree with your numbers. So that is clearly most (if not all) of the problem.JVMerlino wrote:Your needle is right at the top.![]()
Perft 1 is wrong, because there are five legal moves (not four, as shown by your output). You probably aren't counting the en passant capture at d3, which is part of the FEN.
jm
However, my perft 6 is 31753706, whereas yours is 31753730 (difference of 24). But that could be another en passant effect?
jm
-
- Posts: 588
- Joined: Thu Mar 09, 2006 4:47 pm
- Location: Singapore
Re: Does perft include underpromotion?
Seems there are people around who knows how to read chess board diagrams and perft printoutJVMerlino wrote:Your needle is right at the top.![]()
Perft 1 is wrong, because there are five legal moves (not four, as shown by your output). You probably aren't counting the en passant capture at d3, which is part of the FEN.
jm

I just recently implemented perft and uci with setboard from fen. Probably the en passant part is not tested yet. So I will check.
Your observation helps greatly. My level of arithmetic reaches up to addition, subtraction and multiply. "div" would be serious.

I did not expect my move generator to have problems as it is "OLD" and have played many games w/o a hitch.
Many Thanks,
Rasjid
-
- Posts: 1404
- Joined: Wed Mar 08, 2006 10:15 pm
- Location: San Francisco, California
Re: Does perft include underpromotion?
Glad to help! It's hard to say, but I don't think that there would be many games which would make it clear to you that your engine wasn't handling en passant properly. Just because an engine isn't choosing an en passant move, it doesn't mean that it isn't generating those moves properly.Chan Rasjid wrote:Seems there are people around who knows how to read chess board diagrams and perft printoutJVMerlino wrote:Your needle is right at the top.![]()
Perft 1 is wrong, because there are five legal moves (not four, as shown by your output). You probably aren't counting the en passant capture at d3, which is part of the FEN.
jm![]()
I just recently implemented perft and uci with setboard from fen. Probably the en passant part is not tested yet. So I will check.
Your observation helps greatly. My level of arithmetic reaches up to addition, subtraction and multiply. "div" would be serious.![]()
I did not expect my move generator to have problems as it is "OLD" and have played many games w/o a hitch.
Many Thanks,
Rasjid
I would guess that the only time it would come up in an obvious way would be in this instance (analyzing perft data) or in a game in which an en passant move was the only legal move AND your engine declared an invalid checkmate/stalemate. And I just can't see that happening very often.

jm