I'm programming a chess engine from scratch in C++, and I have it playing games on UCI against others already. I spent about four days trying to weed out bugs in my move generator, and finally did manage to make a bug-free movegen.

A few days ago, I implemented quiescence search, for which I lazily copy-pasted my movegen code to get a captures-only movegen function by simply removing all quiet move generations. I presumed it was working which was a bad idea.

I just did a perft on the captures-only function and it already failed at depth 5 on 'Kiwipete'.

For the movegen, I used Sharper for divide perft to weed out bugs. Unfortunately, Sharper does not have a divide perft command for generating only captures and I don't think the source code is available either.

Is there a reliable engine that can do divide perft on just captures?

Update 1: In light of jknappen's comment, I'd like to add more information. 'Perft' refers to performance test, which in chess programming usually refers to an operation which counts the number of leaf nodes (at the end of the tree) of possible legal moves at a certain depth from a starting position. For example, the starting position in chess has 20 leaf nodes at depth 1, while it has 400 leaf nodes at depth 2.It's used for testing whether move generators are working correctly. Refer to this.

Update 2: I used my own engine to test my capture generator (because I know that my regular movegen definitely has no bugs), and I don't see a problem. Although, I used Vice to test my capture movegen (my engine is heavily based off of this one, and I know that it has way of measuring perft), which results is number that's are off exponentially after depth 3. But when I look at the captures themselves, they work correctly. I had to change Vice's code to do the capture perft, which introduces ambiguity, and so it would be nice to have an engine that already has capture perft.

If there isn't any, I'd have to create something new that uses my already existing movegen to verify the integrity of the capture movegen. I have a hunch something is wrong, because in some games as it is about to win, it gives away a major piece (such as a queen), and ends up losing, which makes me think that it's generating captures incorrectly during quiescence (search only captures to make sure nothing is being attacked) search.

Update 3: I ended up using my own movegen to test it. Turns out, I was wrong. Tested 'Kiwipete' to depth 11 and found nothing wrong.

  • I don't think this question is off-topic, but there is space for improvement. For instance, you could explain what the programmers' slang term perft means. Dec 8, 2015 at 8:09
  • @jknappen Done!
    – Shreyas
    Dec 8, 2015 at 14:40

1 Answer 1


I'm not aware of any engine that gives you only capture moves. But you can easily do it yourself, for example, you can easily modify the move generation code in Stockfish such that it only generates capture moves.

It's probably not a good idea to test your implementation with Kiwipete. You should try positions with en-passpant capture, capture with promotion, capture with under-promotion. Once you're comfortable, then move on to the Kiwipete position.

Your Answer

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

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