Does perft include underpromotion?

Discussion of chess software programming and technical issues.

Moderator: Ras

Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Does perft include underpromotion?

Post by Chan Rasjid »

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
vladstamate
Posts: 161
Joined: Thu Jan 08, 2009 9:06 pm
Location: San Francisco, USA

Re: Does perft include underpromotion?

Post by vladstamate »

Hi,

Yes, perft includes underpromotions since those are legal moves too.

Regards,
Vlad.
Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Re: Does perft include underpromotion?

Post by Chan Rasjid »

vladstamate wrote:Hi,

Yes, perft includes underpromotions since those are legal moves too.

Regards,
Vlad.
Thanks.

Now's the problem - trickest of part to seek needle in a haystack or under the ocean floor.

Rasjid
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Does perft include underpromotion?

Post by michiguel »

Chan Rasjid wrote:
vladstamate wrote:Hi,

Yes, perft includes underpromotions since those are legal moves too.

Regards,
Vlad.
Thanks.

Now's the problem - trickest of part to seek needle in a haystack or under the ocean floor.

Rasjid
Use perftdiv to find the needle

Miguel
Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Re: Does perft include underpromotion?

Post by Chan Rasjid »

[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
Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Re: Does perft include underpromotion?

Post by Chan Rasjid »

michiguel wrote:
Chan Rasjid wrote:
vladstamate wrote:Hi,

Yes, perft includes underpromotions since those are legal moves too.

Regards,
Vlad.
Thanks.

Now's the problem - trickest of part to seek needle in a haystack or under the ocean floor.

Rasjid
Use perftdiv to find the needle

Miguel
BTW your number of posts is 2292 and mine is 229.

This is real WORK :x

Rasjid
JVMerlino
Posts: 1404
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Does perft include underpromotion?

Post by JVMerlino »

Your needle is right at the top. :D

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
JVMerlino
Posts: 1404
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Does perft include underpromotion?

Post by JVMerlino »

JVMerlino wrote:Your needle is right at the top. :D

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
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.

However, my perft 6 is 31753706, whereas yours is 31753730 (difference of 24). But that could be another en passant effect?

jm
Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Re: Does perft include underpromotion?

Post by Chan Rasjid »

JVMerlino wrote:Your needle is right at the top. :D

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
Seems there are people around who knows how to read chess board diagrams and perft printout :lol:

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. :oops:

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
JVMerlino
Posts: 1404
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Does perft include underpromotion?

Post by JVMerlino »

Chan Rasjid wrote:
JVMerlino wrote:Your needle is right at the top. :D

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
Seems there are people around who knows how to read chess board diagrams and perft printout :lol:

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. :oops:

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
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.

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