User Tools

Site Tools


chess:programming:divide

Chess - Programming - Divide

While perft is a great help to discover if there are any bugs in the code generation, there still remains the problem tracking the bugs down.

One approach is to go step by step through all the possible moves at depth 1 and compare the Perft values with the Perft values of another reliable program.

  • That can be a bit time consuming if the initial position already has a lot of legal moves.
  • One way to make things simpler is to implement a function that counts the moves and the number of child moves.
  • Once this feature is implemented, finding bugs gets simpler and definitely much quicker.

Example for divide with the position from above.

FEN-string: n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1

returns:

roce: divide 5
d7e7 203075
d7c7 144121
d7d6 211186
d7c6 198410
d7e8 146984
d7e6 226311
a8c7 287482
a8b6 232333
c8b6 190892
c8a7 185316
c8e7 221064
c8d6 249997
g2g1 196031
g2g1 201350
g2g1 72525
g2g1 24145
g2f1 33700
g2f1 91129
g2f1 33399
g2f1 54682
g2h1 141001
g2h1 92321
g2h1 109225
g2h1 58424
Moves: 24
Nodes: 3605103

NOTE: divide depth gives you the legal moves with the number of their child moves.

  • It is like you would make a move in this position and call perft with the argument depth-1 from the resulting position.
chess/programming/divide.txt · Last modified: 2021/10/12 00:09 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki