2

I'm writing a chess engine for fun. Currently I'm finishing writing the move generator. During the research I leaned about PERFT for debugging my software. Indeed, I found many bugs, some of them was "amazing" mistakes.

But now, I'm blocked in a wrong perft result for discovered checks.

This position

[FEN "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1 "] 

that I found in the Chess Programming Wiki shows 1292 positions of discovered check in the depth 5. But my move generator found 1295 (three more). However, the total number of positions are the same.

My move generator matches with results of Chess Programming Wiki for all other values, in all depths from 1 to 5, except for discovered checks in the depth 5.

My results (depth 5):

  • Nodes - 674624
  • Captures - 52051
  • En passants - 1165
  • Castlins - 0
  • Promotions - 0
  • Checks - 52950
  • Discovery checks - 1295 (the problem)
  • Double checks - 3
  • Checkmates - 0

Results from Chess Programming Wiki (depth 5):

  • Nodes - 674624
  • Captures - 52051
  • En passants - 1165
  • Castlins - 0
  • Promotions - 0
  • Checks - 52950
  • Discovery checks - 1292
  • Double checks - 3
  • Checkmates - 0

Finally, I'd like you to give some facts about other perft generators capable of calculating the number of discovered checks, pawn promotions, castling, etc... not only the total number of nodes. I have found some perft generators, but only for calculating total number of positions.

  • 1
    Hello, Wellyab! Welcome to Chess.SE. As your question stands, it doesn't directly ask any single question; it seems to merely hint at several questions. This site requests that users ask one explicit question per question post - an edit on your part should be able to fix that. Thanks, and have a great day! – Brandon_J Jul 26 at 0:58
  • 4
    Just a shot in the dark from the numbers you gave: Could it be that you are counting the double checks twice, since they necessarily also have to be discovered checks? – Fabian Fichter Jul 26 at 7:21
  • @FabianFichter you're right. I found other cases where the extra movements for discovery checks are equals to the total number of double checks. But I don't had read in any place that double checks should not count a discovery checks. Now I'm fixing the the part in the program that counts these valuse to test the results. Thank you very much. – Welyab Paula Jul 27 at 4:20
  • I just found another bug. When the king is in check by a bishop, for sample, and there is a queen on the same diagonal, my program was recognize that scenario as double check. This board shows the situation: lichess.org/analysis/standard/8/2k5/8/8/5p2/8/3Q3B/1K6_w_-_-. After Qf4+, my program considered that queen and bishop were attacking the king. – Welyab Paula Jul 27 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.