We need to scrap Perft()

Discussion of chess software programming and technical issues.

Moderator: Ras

R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: We need to scrap Perft()

Post by R. Tomasi »

Ras wrote: Sat Dec 18, 2021 6:18 pm
Mergi wrote: Sat Dec 18, 2021 5:38 pmFor example, what about check evasions?
Since that should also be part of main search, regular perft covers that aspect. That's also why I don't really see the need for a checkperft. Without checkperft, we could stay with cperft for the capture / QS test.
checkperft was about generating checks only, not check-evasions. But honestly, I'm fine staying with cperft for the capture/QS test. I don't see support for something like a checkperft gaining much traction...
R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: We need to scrap Perft()

Post by R. Tomasi »

Mergi wrote: Sat Dec 18, 2021 6:38 pm It only way this would kind of make sense to me is if you didn't stop in ply + 1, but instead explored all the captures and promotions fully.
Well, the problem with that is: assume you get numbers differing from the reference. How do you go about debugging that then? The difference might happen like 10ply down from the leaf...
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: We need to scrap Perft()

Post by dangi12012 »

Could somebody post a table with the new cperft() ?

Code: Select all

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [0] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [1] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [2] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [3] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [4] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [5] = ?

r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [0] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [1] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [2] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [3] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [4] = ?
Now we said non recrsive leaf nodes - or fully recursive leaf nodes?
I would be happier to see them fully recursive since that is more in engine style.
But only pending captures and pending promotions.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
User avatar
Ras
Posts: 2696
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: We need to scrap Perft()

Post by Ras »

dangi12012 wrote: Sun Dec 19, 2021 9:07 pmI would be happier to see them fully recursive since that is more in engine style.
That would be bad because it would lead to QS explosion - and unlike perft where you have strict control over the recursion depth, recursive QS would explode in many positions due to plunder raids. That's why in real engine QS, you need to combat this problem e.g. by a recapture-on-same-square mode from a certain QS depth on.
Rasmus Althoff
https://www.ct800.net
R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: We need to scrap Perft()

Post by R. Tomasi »

dangi12012 wrote: Sun Dec 19, 2021 9:07 pm Could somebody post a table with the new cperft() ?

Code: Select all

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [0] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [1] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [2] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [3] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [4] = ?
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 [5] = ?

r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [0] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [1] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [2] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [3] = ?
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - [4] = ?
Now we said non recrsive leaf nodes - or fully recursive leaf nodes?
I would be happier to see them fully recursive since that is more in engine style.
But only pending captures and pending promotions.
See my posts. I posted results for the starting pos and for kiwi-pete. It was done with only one ply-depth capture and excluding any underpromotions.
User avatar
Ras
Posts: 2696
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: We need to scrap Perft()

Post by Ras »

R. Tomasi wrote: Tue Dec 21, 2021 12:03 pmSee my posts. I posted results for the starting pos and for kiwi-pete. It was done with only one ply-depth capture and excluding any underpromotions.
I get different results for Kiwipete (r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1):
cperft 0: 8
cperft 1: 351
cperft 2: 17102
cperft 3: 753124
cperft 4: 35043030

My suspicion is that leaf underpromotions that also happen to be captures are counted in Mergi's implementation, but they shouldn't be counted:
Mergi wrote: Sat Dec 18, 2021 5:24 pm

Code: Select all

    if (board.CapturedPiece() || GetMoveType(m) == PROMOTE_QUEEN) {
        ++total_nodes;
    }
If I modify my move gen to also include underpromotions that are captures, then I get 758998 for cperft 3, but as you said above, no underpromotions at all in the leaf nodes.
Rasmus Althoff
https://www.ct800.net
R. Tomasi
Posts: 307
Joined: Wed Sep 01, 2021 4:08 pm
Location: Germany
Full name: Roland Tomasi

Re: We need to scrap Perft()

Post by R. Tomasi »

Ras wrote: Wed Dec 22, 2021 4:19 pm
R. Tomasi wrote: Tue Dec 21, 2021 12:03 pmSee my posts. I posted results for the starting pos and for kiwi-pete. It was done with only one ply-depth capture and excluding any underpromotions.
I get different results for Kiwipete (r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1):
cperft 0: 8
cperft 1: 351
cperft 2: 17102
cperft 3: 753124
cperft 4: 35043030

My suspicion is that leaf underpromotions that also happen to be captures are counted in Mergi's implementation, but they shouldn't be counted:
Mergi wrote: Sat Dec 18, 2021 5:24 pm

Code: Select all

    if (board.CapturedPiece() || GetMoveType(m) == PROMOTE_QUEEN) {
        ++total_nodes;
    }
If I modify my move gen to also include underpromotions that are captures, then I get 758998 for cperft 3, but as you said above, no underpromotions at all in the leaf nodes.
Underpromotions shouldn't be counted in my implementation - I actually double checked to be sure about that, but of course it's possible that I still f*cked up. Unfortunately I am not home currently and can't access my code from here - I'll have to wait till after the x-mas holidays to check again.
Mergi
Posts: 127
Joined: Sat Aug 21, 2021 9:55 pm
Full name: Jen

Re: We need to scrap Perft()

Post by Mergi »

Ras wrote: Wed Dec 22, 2021 4:19 pm My suspicion is that leaf underpromotions that also happen to be captures are counted in Mergi's implementation, but they shouldn't be counted:
Mergi wrote: Sat Dec 18, 2021 5:24 pm

Code: Select all

    if (board.CapturedPiece() || GetMoveType(m) == PROMOTE_QUEEN) {
        ++total_nodes;
    }
:cry:
You are absolutely right.