Perft statistics - chessprogrammingwiki

Discussion of chess software programming and technical issues.

Moderator: Ras

myirci
Posts: 3
Joined: Sun Oct 10, 2021 4:38 am
Full name: Murat Yirci

Perft statistics - chessprogrammingwiki

Post by myirci »

Hi all,

I have been working on a move generator and as usual I tested it with lots of positions (many many thousands) that I found online. The number of nodes are all correct. I also wanted to verify the statistics (number of captures, promotions, check mates, checks, double checks, castles, discovery checks, stale mates, etc.) for a given position, at a given depth. For the starting position, my results are equivalent to what is given in the https://www.chessprogramming.org/Perft_Results

However, for the kiwipete postion at depth 5, the number of double checks does not match with my results. I get 2645 double checks whereas in the chessprogrammingwiki table, it is 2637. I do not know where those numbers come but my question is, has anybody verified those numbers before? I have the FEN positions and the move sequences of the 2645 positions, if any of you interested I can share.

Thanks.
yeni_sekme
Posts: 40
Joined: Mon Mar 01, 2021 7:51 pm
Location: İstanbul, Turkey
Full name: Ömer Faruk Tutkun

Re: Perft statistics - chessprogrammingwiki

Post by yeni_sekme »

I also find 2645 like you.
Mergi
Posts: 127
Joined: Sat Aug 21, 2021 9:55 pm
Full name: Jen

Re: Perft statistics - chessprogrammingwiki

Post by Mergi »

Funnily enough, i'm getting 2651 with my move gen :shock:

Are you counting only in the terminal nodes or all along the way? In depth 4 i'm getting 6, and depth 5 is 2645 for a total of 2651.

Actually looking at some other positions on the wiki, i'm a bit confused. For example "position 3" has 3 double checks for depth 5 but 0 double checks for depth 6. I guess it's counted only in the leaf nodes ... which doesn't make much sense to me, since nodes are counted as a total sum, so why count other statistics differently?
Mergi
Posts: 127
Joined: Sat Aug 21, 2021 9:55 pm
Full name: Jen

Re: Perft statistics - chessprogrammingwiki

Post by Mergi »

Nevermind that last part about nodes. But I'm still confused about how double checks should be counted. Wouldn't it make sense to count all along the way?
Uri Blass
Posts: 10794
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Perft statistics - chessprogrammingwiki

Post by Uri Blass »

Mergi wrote: Tue Oct 12, 2021 4:21 pm Funnily enough, i'm getting 2651 with my move gen :shock:

Are you counting only in the terminal nodes or all along the way? In depth 4 i'm getting 6, and depth 5 is 2645 for a total of 2651.

Actually looking at some other positions on the wiki, i'm a bit confused. For example "position 3" has 3 double checks for depth 5 but 0 double checks for depth 6. I guess it's counted only in the leaf nodes ... which doesn't make much sense to me, since nodes are counted as a total sum, so why count other statistics differently?
perft count only leaf nodes.
I do not see something illogical in the definition.

If you are interested also in nodes that are not leaf nodes you can calculate the sum of perft of different depths.
myirci
Posts: 3
Joined: Sun Oct 10, 2021 4:38 am
Full name: Murat Yirci

Re: Perft statistics - chessprogrammingwiki

Post by myirci »

Thanks, now I am more confident in my results :) My movegen is not the fastest and I cannot go in higher depths but it would be nice if someone fixes the chessprogrammingwiki statistics.

@Mergi - To my understanding, it is the general consensus. For the nodes, we only count the total number of leaves at a given depth. For instance, for the starting position, we say perft(1) = 20 and perft(2) = 400 (not 420).
Mergi
Posts: 127
Joined: Sat Aug 21, 2021 9:55 pm
Full name: Jen

Re: Perft statistics - chessprogrammingwiki

Post by Mergi »

You are right, a brain fart on my part. :D Yeah, it's 2645. 8-)
myirci
Posts: 3
Joined: Sun Oct 10, 2021 4:38 am
Full name: Murat Yirci

Re: Perft statistics - chessprogrammingwiki

Post by myirci »

Other discussion points are,
  • Do you increment the number of checks by two or one in the case of a double check? If we are counting positions (nodes) with at least a single check, we should increment by 1 (as in the chess programming wiki results). I am incrementing by 2 but probably incrementing by 1 is the correct approach.
  • Do you increment the number of discovery checks when there is a double check? I do. In the chess programming wiki results, a double check is not counted as a discovery check.
P.S. For the kiwipete depth 6, I got the number of double checks as 55014 which is also different then the chess programming wiki.
alessandro
Posts: 52
Joined: Tue Aug 12, 2014 11:21 am
Location: Lund
Full name: Alessandro Iavicoli

Re: Perft statistics - chessprogrammingwiki

Post by alessandro »

myirci wrote: Tue Oct 12, 2021 7:06 pm Other discussion points are,
  • Do you increment the number of checks by two or one in the case of a double check? If we are counting positions (nodes) with at least a single check, we should increment by 1 (as in the chess programming wiki results). I am incrementing by 2 but probably incrementing by 1 is the correct approach.
  • Do you increment the number of discovery checks when there is a double check? I do. In the chess programming wiki results, a double check is not counted as a discovery check.
P.S. For the kiwipete depth 6, I got the number of double checks as 55014 which is also different then the chess programming wiki.
This may explain the difference. We are chess engine developer and we might find interesting to prove it, I mean, to prove that the difference are in the strategies adopted in counting nodes and not due to bugs in the engine.

The algorithm for the chessprogramming wiki is based on the fact that counts the nodes. A double check is not counted both as discovery check and a check but as a "double check", because it is a single node. Same for checkmates.
Note that this is not in contrast, for example, with the promotions: those are always counted as 4 nodes, because in the move generator the engine create 4 different moves (one for each promovable piece).

This is the way I've implemented the algorithm.



[fen]r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -[/fen]


This is the result of the perft and divide funtion for the kiwipete position up to depth 6. If you guys have implemented the same algorithm, we may find together the correct value :)

Code: Select all

AdaChess v.3.8.7 => perft 6
Depth       Nodes        Captures      En-Passant         Castles      Promotions          Checks    Discovery C.       Double C.      Checkmates   Time
1              48               8               0               2               0               0               0               0               0   0.00
2            2039             351               1              91               0               3               0               0               0   0.00
3           97862           17102              45            3162               0             993               0               0               1   0.00
4         4085603          757163            1929          128013           15172           25523              42               6              43   0.21
5       193690690        35043416           73365         4993637            8392         3309887           19883            2637           30171   9.29
6      8031647685      1558445089         3577504       184513607        56627920        92238050          568417           54948          360003 571.30

Nps: 14058546
AdaChess v.3.8.7 => divide 6
Move                 Nodes        Captures      En-Passant         Castles      Promotions          Checks    Discovery C.       Double C.      Checkmates
g3               141076301        24483982           67975         3398839           38680          943302            4926             418            1442
g4               135208177        25123455           66420         3260167           36740          906959            5019             418            1323
gxh3             158328615        29178632           72821         3708823           25928         1086238            5475             429            1380
Kf1              139601450        26478444           65259         3270488           95240         6064406           35606           11796            3185
Kd1              148612404        28574940           67073         3495344         1225160         4583694            9213            3284            2280
b3               153953689        29481000           74773         3702163         1224060         1668617            4565             408            4936
Nd1              165415976        29077143          130992         3931646         1317808         1675428            3203              64            5719
Nb1              165673862        29011998          129199         3930106         1327992         1887211            5067             440            7450
Na4              191260040        36878644           71646         4492166         1543352         2098622            5101             444            8480
Nb5              166970874        30918524          127505         3942384         1473860         1785009            1795             134            1824
a3               197413067        40162639            7755         4699200         1494412         1985354            5125             428            5410
a4               183872225        37734784            6269         4435329         1422860         1903072            5058             424            5322
Rb1              160413321        30628751           71620         3817246         1238656         1706436            4998             418            4885
Rc1              159720218        30387658           73146         3800222         1230060         1681156            4880             394            5162
Rd1              149265033        28731024           68523         3548546         1146904         1442329            3167              66            4381
Bd3              167737155        32266462           75915         4009936         1346680         2047357           13505             144            2496
Bc4              170094798        35185655           68369         4076372         1427048         2195329           84622            9710            5324
Bb5              158033152        31538520           67832         3753965         1415684         2143161           20459             966            7151
Bxa6             130642863        25053852           60540         1905741         1368444         1858747           14882             166            1150
Bf1              174218453        33159603           79838         4145562         1905672         1627279           43121             231            4691
Bd1              131348645        23184862           66289         3143196          985164         1309092           57716            6403           50685
Qf4              181938761        34769050           79470         4324690         1429736         1787275            9903            1159           26235
Qf5              226135507        48118623           92742         5362947         1680144         2350494           14012            1278           27717
Qxf6             146338070        29562020           66869         3361900         1444728         1865885            6390            1036           24527
Qg4              189789456        38140339           80740         4520687         1534016         2054720            6641             694            7440
Qh5              197839051        44085753           83350         4783073         1544160         2137999            8758             964           20547
Qg3              198078522        37418312           82871         4718244         1642928         2119152           10276            1210            7035
Qxh3             210100865        38614007           86457         4897621           34768         1449161           10471            1246            4749
Qe3              189120807        35741293           81254         4519428         1468056         1731298            6477            1146           25984
Qd3              164583144        31332982           73376         3936608         1309844         1657314            2007               6            4833
Nxf7             176070755        36578841           78242         2470577         1306424         1982026           15496             449            5710
Nxg6             165477768        33429847           73499         2733000         1296780         1959339           15386             429            5492
Ng4              144264874        27236164           70601         3566498         1085372         1639564           13257             449            3377
Nd3              140737072        25105943           66778         3606742         1031208         1412873            4753               8             761
Nc4              145182844        28465152           60856         3633984         1114212         1495970            8632             376             874
Nc6              169836097        34612955           71695         2642990         1387380         2048774           15937             419            5544
Nxd7             193856446        43537096           83286         3121280         1331268         2096697           15670             537            5907
Rg1              166086672        31173614           74654         3982960          170072         1250048            4997             418            2068
Rf1              154273720        29607262           71851         3673431         1242984         1174742            3115              88           15616
Be3              184114087        35387223           79251         4393261         1441616         2262357            8113            1006             649
Bf4              165805784        31423842           74540         3944862         1288844         2190202            9708             956             629
Bg5              177883051        35462433           76752         4212082         1469136         2478013           10203            1012            1099
Bh6              161319567        35468278           71602         3997887         1341648         2529739           10111             976            1132
Bc1              158801466        29849921           72872         3769837         1229708         2327663            9604             960             779
d6               151133066        27841512           70712         3529280         1326484         1654692            2592             442            6318
dxe6             203255191        36637213           88064         4675540         1377388         2108970            7571             492            7336
O-O              172063416        32926344           76553         4129740          616996          851153             550               5            8623
O-O-O            148701308        28678498           68808         3537017         1191616         1023132             284               2            4346
--
AdaChess - Smart Chess Engine - https://github.com/adachess/AdaChess

Image