I am writing a chess engine, and I am comparing my move generation results with Stockfish. I am currently stumped by this result.

In this position 8/2p5/8/KP1p2kr/5p2/8/4P1P1/6R1 w - - from https://www.chessprogramming.org/Perft_Results, at depth 6, my engine has 11030061 moves while Stockfish gets 11030083. I follow the discrepancies in nodes visited from each root position until I reach this position 8/2p5/8/KP1p2kr/5p2/8/4P1P1/6R1 w - - 0 1. At depth 2 Stockfish finds 256 positions, I find 255. The discrepancy is at g2g4. Stockfish finds 16 nodes, I find 15. When I make g2g4 then run Stockfish on this new position, it finds 15 moves, the same as my engine. Counting the moves in 8/2p5/8/KP1p2kr/5pP1/8/4P3/6R1 b - - 0 1 by hand, it seems to me that there should be 15.

Why does Stockfish find a 16th move from g2g4 at depth 2 in 8/2p5/8/KP1p2kr/5p2/8/4P1P1/6R1 w - - 0 1 and yet when g2g4 is made, it finds 15 moves for black?

1 Answer 1


you are missing an en passant capture

  • Oh yes, that's right. When I was testing this, I was using Lichess Board editor, and forgot to add the en passant square to the fen, so stockfish didn't count it either. I didn't see it when I counted by hand because I missed the fact that the black pawn would block the check. Thank you very much!
    – Ilan
    Commented Jan 31 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.