User Tools

Site Tools


chess:programming:perft

This is an old revision of the document!


Chess - Programming - Perft

Perft does a raw node count, up to some specified depth, by doing a full tree search.

Draws by threefold repetition are ignored.


Perft Values

Start Positition

Perft against normal opening position:

FEN-string: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
DepthNodesCapturesE.p.CastlesPromotionsChecksCheckmatesTotal Nodes
12000000020
2400000000420
38902340001209322
419728115760004698206603
548656098271925800273513475072212
6119060324281200852480079827110828124132536
731959018603320034396 32668081435767
884998978956 9591295579852036
92439530234167 35695709940400191963
1069352859712417 10788546694868790619155
112097651003696806 391476876618031078854669486
1262,854,969,236,701,747 12244485286520168361091858959

Checks

DepthChecksDirect Check OnlySingle Discovered Check OnlyDirect and Discovered ChecksDouble Discovered Checks
1000000
2000000
3121200012
4469461800461
5273512699860027004
6798271797896329460
732668081326484271802616280
89591295579581353038473091472150
9356957099403565306099637101713554722110
10107885466948610770204938591531274015302900733879
113914768766180339068470901662674948503051172185239357443
121224448528652016

NOTE: Definitions are:

  • Direct Check: When a piece which moved gives check.
    • A check given by one piece when another friendly piece moves out of the way.
    • This excludes cases where the check happens because an enemy pawn gets captured En Passant.
  • Discovered Check: When a piece which didn't move gives check.
  • Double Check: When two pieces give check. Split into two categories: “direct and discovered check” and “double discovered check”.
    • A double check is a discovered check where the moving piece also gives check.
    • This definition excludes cases where a king is under two discovered attacks.
    • Also in general the expression “the moving piece” sounds awkward, because two pieces move during castling.

Perft Estimates

DepthNodes
131.9810e+18
146.187e+19
152.015e+21
166.507e+22
172.175e+24
187.214e+25
192.462e+27
208.350e+28

NOTE: These estimates are done by randomly pruning the game tree.


Good Test Position

The startposition is not a very good test position as it does not uncover flaws that might still be hidden regarding promotion or castling.

  • Therefore the following position should be a better test.
FEN-string: r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1 
DepthNodesCapturesE.p.CastlesPromotionsChecksCheckmatesTotal Nodes
14880200048
220393511910302087
397862171024531620993199949
4408560375716319291280131517225523434185552
5193690690350434167336549936378392330988730171197876242
68031647685 8229523927

Discover promotion bugs

The following position does not look very realistic but nevertheless helps to uncover promotion bugs.

FEN-string: n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1 
DepthNodesTotal Nodes
12424
2496520
3948310003
4182838192841
536051033797944
67117913974977083

Position 2

FEN-string: 8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - -
DepthNodesCapturesE.p.CastlesPromotionsChecksCheckmatesTotal Nodes
114100020
219114000100
328122092002670
443238334812300168017
567462452051116500529500
61103008394035033325075524524732733
71786336611451903629487401400241279740687

Position 3

FEN-string: r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1

Or mirrored (with the same perft results):

FEN-string: r2q1rk1/pP1p2pp/Q4n2/bbp1p3/Np6/1B3NBn/pPPP1PPP/R3K2R b KQ - 0 1
DepthNodesCapturesE.p.CastlesPromotionsChecksCheckmatesTotal Nodes
1600000
226487064810
3946710214012038
4422333131393077956003215492
515833292204617365120329464200568
6706045033210369132212108820068110298426973664

—-

References

chess/programming/perft.1634030807.txt.gz · Last modified: 2021/10/12 09:26 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki