Position 1: Initial position
FEN:
Code: Select all
depth nodes checks captures checkmates
1 44 0 2 0
2 1,920 6 72 0
3 79,666 384 3,159 0
4 3,290,240 19,380 115,365 0
5 133,312,995 953,251 4,917,734 0
6 5,392,831,844 39,288,662 185,194,510 584
7 217,154,523,878 1,793,957,429 7,806,689,172 29,150
8 8,737,663,095,907 71,125,910,451 303,251,726,428 4,083,622
9 352,226,653,990,275 3,155,476,718,855 12,781,706,774,202 182,581,992
10 14,187,549,274,751,861 125,057,982,988,020 509,498,168,281,284 13,831,340,296
FEN: r1ea1a3/4kh3/2h1e4/pHp1p1p1p/4c4/6P2/P1P2R2P/1CcC5/9/2EAKAE2 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 38 1 1 0
2 1,128 12 10 0
3 43,929 1,190 2,105 0
4 1,339,047 21,299 31,409 23
5 53,112,976 1,496,697 3,262,495 1,537
6 1,663,640,378 29,697,750 55,945,766 41,673
7 66,742,966,316 1,960,700,294 4,740,705,145 2,702,397
8 2,142,014,636,456 39,524,028,541 88,410,505,039 62,159,428
9 86,413,551,364,229 2,638,908,733,541 6,769,016,991,326 3,645,360,756
10 2,830,006,985,783,112 52,300,489,303,217 134,151,779,490,661 88,186,803,110
FEN: 1ceak4/9/h2a5/2p1p3p/5cp2/2h2H3/6PCP/3AE4/2C6/3A1K1H1 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 7 0 0 0
2 281 9 10 0
3 8,620 64 540 0
4 326,201 10,121 11,730 0
5 10,369,923 162,542 660,479 3
6 380,156,340 11,748,261 14,627,168 2,302
7 12,345,505,147 218,725,663 806,263,565 37,989
8 445,309,747,371 13,751,134,332 18,559,293,496 4,801,845
9 14,614,113,572,802 266,274,473,825 977,827,445,317 86,519,165
10 521,995,912,658,933 16,061,905,823,721 23,454,619,449,916 7,310,094,390
FEN: 5a3/3k5/3aR4/9/5r3/5h3/9/3A1A3/5K3/2EC2E2 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 25 3 2 0
2 424 9 6 0
3 9,850 963 771 0
4 202,884 8,699 9,179 12
5 4,739,553 380,858 326,535 161
6 100,055,401 4,582,930 5,001,139 4,345
7 2,447,759,037 166,331,869 143,760,961 163,653
8 52,307,997,357 2,408,154,816 2,668,348,453 2,325,098
9 1,343,160,831,754 80,132,288,711 67,079,153,812 97,462,707
10 28,838,171,664,689 1,332,698,893,123 1,476,550,279,562 1,203,847,678
FEN: CRH1k1e2/3ca4/4ea3/9/2hr5/9/9/4E4/4A4/4KA3 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 28 12 1 0
2 516 15 7 0
3 14,808 3,041 675 0
4 395,483 12,444 11,485 162
5 11,842,230 1,254,024 590,801 495
6 367,168,327 11,779,169 14,499,871 116,750
7 11,194,690,506 825,591,992 583,666,802 476,743
8 366,768,760,741 12,248,499,805 16,860,361,852 85,997,356
9 11,316,892,742,588 678,308,656,892 599,101,339,831 437,397,863
10 380,911,906,724,558 13,152,214,083,387 18,848,190,024,072 64,245,967,343
FEN: R1H1k1e2/9/3aea3/9/2hr5/2E6/9/4E4/4A4/4KA3 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 21 4 1 0
2 364 16 22 0
3 7,626 784 502 0
4 162,837 5,865 10,683 17
5 3,500,505 236,182 241,214 24
6 81,195,154 2,753,081 5,470,269 5,585
7 1,765,627,003 93,795,634 120,586,840 14,385
8 42,424,719,146 1,426,561,933 2,828,476,506 1,967,775
9 929,895,135,908 43,484,217,259 61,439,386,737 10,745,724
10 22,656,480,355,626 767,893,400,007 1,473,581,068,609 803,291,479
FEN: C1hHk4/9/9/9/9/9/h1pp5/E3C4/9/3A1K3 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 28 2 0 0
2 222 0 12 0
3 6,241 464 40 0
4 64,971 105 4,966 0
5 1,914,306 116,319 17,459 0
6 23,496,493 134,225 1,895,759 1,089
7 713,048,593 34,857,153 7,808,522 0
8 9,711,548,664 75,280,993 768,711,235 726,865
9 300,586,365,694 12,340,552,491 3,663,066,815 24,061
10 4,378,452,618,313 44,181,673,494 331,908,254,483 352,702,439
FEN: 4ka3/4a4/9/9/4H4/p8/9/4C3c/7h1/2EK5 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 23 8 1 0
2 345 4 6 0
3 8,124 1,524 179 0
4 149,272 3,201 2,857 32
5 3,513,104 390,765 57,928 274
6 71,287,903 1,922,146 1,212,926 17,907
7 1,657,573,114 132,843,535 28,345,589 153,992
8 35,087,900,502 1,045,205,635 558,444,756 8,611,930
9 805,901,318,220 52,908,764,098 15,107,162,709 71,785,076
10 17,446,699,531,702 539,614,961,239 273,248,855,042 4,209,601,416
FEN: 2e1ka3/9/e3H4/4h4/9/9/9/4C4/2p6/2EK5 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 21 6 1 0
2 195 28 30 0
3 3,883 411 135 0
4 48,060 6,419 6,087 0
5 933,096 71,759 26,841 0
6 12,250,386 1,409,925 1,290,768 1,136
7 235,622,620 14,168,904 5,848,140 1,312
8 3,223,442,295 330,779,266 288,286,382 195,357
9 61,976,856,602 3,213,463,588 1,424,784,285 3,564,547
10 856,769,945,175 79,527,026,317 66,165,224,144 44,257,146
FEN: 1C2ka3/9/C1Hae1h2/p3p3p/6p2/9/P3P3P/3AE4/3p2c2/c1EAK4 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 30 2 3 0
2 830 55 64 0
3 22,787 858 2,163 0
4 649,866 39,719 57,076 65
5 17,920,736 518,816 1,625,453 44
6 517,687,990 29,340,751 48,536,896 43,720
7 14,455,679,002 383,843,427 1,261,613,671 58,555
8 421,689,225,752 22,355,099,771 40,836,967,120 28,351,366
9 11,955,334,228,633 309,121,766,222 1,009,093,177,933 58,507,090
10 352,462,159,702,536 17,646,344,479,723 34,623,825,090,952 19,782,310,723
FEN: ChH1k1e2/c3a4/4ea3/9/2hr5/9/9/4C4/4A4/4KA3 w - - 0 1
Code: Select all
depth nodes checks captures checkmates
1 19 3 2 0
2 583 15 14 0
3 11,714 1,680 880 0
4 376,467 12,434 14,459 2
5 8,148,177 988,563 537,908 362
6 270,587,571 9,963,307 12,300,582 1,424
7 6,347,480,650 622,266,982 380,559,237 391,244
8 218,080,917,174 8,558,789,381 10,793,188,064 1,402,277
9 5,477,201,520,455 435,125,936,179 301,126,140,779 390,573,055
10 193,881,133,546,122 7,872,885,590,188 9,988,415,709,190 1,533,023,114
Below is the code for Perft in Pikafish (a Chinese chess engine). I have quickly modified it to get all stats to verify with my ones.
Code: Select all
#ifndef PERFT_H_INCLUDED
#define PERFT_H_INCLUDED
#include <cstdint>
#include "movegen.h"
#include "position.h"
#include "types.h"
#include "uci.h"
namespace Stockfish::Benchmark {
static uint64_t checks, captures, mates;
// Utility to verify move generation. All the leaf nodes up
// to the given depth are generated and counted, and the sum is returned.
template<bool Root>
uint64_t perft(Position& pos, Depth depth) {
StateInfo st;
TimePoint startPoint;
uint64_t cnt, nodes = 0;
const bool leaf = (depth == 2);
MoveList<LEGAL> ml(pos);
if (Root) {
startPoint = now();
}
for (const auto& m : ml)
{
if (Root && depth <= 1)
cnt = 1, nodes++;
else
{
pos.do_move(m, st);
if (leaf) {
auto moveList = MoveList<LEGAL>(pos);
cnt = moveList.size();
if (cnt > 0) {
for (const auto& m : MoveList<LEGAL>(pos))
{
auto to = m.to_sq();
if (!pos.empty(to)) {
captures++;
}
if (pos.gives_check(m)) {
checks++;
}
}
} else {
mates++;
}
} else {
cnt = perft<false>(pos, depth - 1);
}
nodes += cnt;
pos.undo_move(m);
}
if (Root)
sync_cout << UCIEngine::move(m) << ": " << cnt << sync_endl;
}
if (Root)
sync_cout << "Elapsed: " << now() - startPoint << " ms" << sync_endl;
return nodes;
}
inline uint64_t perft(const std::string& fen, Depth depth) {
StateInfo st;
Position p;
p.set(fen, &st);
checks = captures = mates = 0;
auto nodes = perft<true>(p, depth);
sync_cout << depth << " " << nodes << " " << checks << " " << captures << " " << mates << sync_endl;
return nodes;
}
}
#endif // PERFT_H_INCLUDED
