Answers.Body: <p>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.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-08T00:50:07.510Z
Answers.LastActivityDate: 2015-12-08T00:50:07.510Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>Actually I had a similar (same?) problem while writing my engine. It has a function in it that generates perft for tactical moves (so captures and promotions; any material-changing move).
  It seems to be working but I've never really bothered crosschecking it against other engine.
  If you (or anyone) still wants to use it you can look it up here:
  <a href="https://github.com/macsmol/machess" rel="nofollow noreferrer">https://github.com/macsmol/machess</a></p>
  <p>Two remarks:</p>
  <ol>
  <li><p>The function is there inside the engine (see method tacticalMoveGenerationTest() in StateTest.java) but not really exposed to the end user. Let me know if you want me to add it.</p>
  </li>
  <li><p>Implementation details:</p>
  <p>-The function does normal perft except at the maximum depth it generates only tactical moves.</p>
  <p>-if a move is a promotion and a capture at the same time then it is counted as one move. So capturing with white pawn on a8 gives 4 moves (every promotions).</p>
  </li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-02T07:22:29.273Z
Answers.LastActivityDate: 2024-06-02T07:23:13.180Z
Answers.LastEditDate: 2024-06-02T07:23:13.180Z
Answers.UserDisplayName: Maciej S
Body: <p>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.</p>
  
  <p>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.</p>
  
  <p>I just did a perft on the captures-only function and it already failed at depth 5 on 'Kiwipete'.</p>
  
  <p>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.</p>
  
  <p>Is there a reliable engine that can do divide perft on just captures?</p>
  
  <p><strong><em>Update 1</em></strong>: 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 <em>legal</em> 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 <em><a href="https://chessprogramming.wikispaces.com/Perft+Results" rel="nofollow">this</a></em>.</p>
  
  <p><strong><em>Update 2:</em></strong> 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 <em><a href="http://bluefever.net/Downloads/ViceReadMe.html" rel="nofollow">Vice</a></em> to test my capture movegen (my engine is heavily based off of this one, and I know that it has way of <em>measuring</em> 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.</p>
  
  <p>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 <em>quiescence</em> (search only captures to make sure nothing is being attacked) search.</p>
  
  <p><strong><em>Update 3</em></strong>: I ended up using my own movegen to test it. Turns out, I was wrong. Tested 'Kiwipete' to depth 11 and found nothing wrong.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-08T08:09:57.583Z
Comments.Text: 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.
Comments.UserDisplayName: Sir Cornflakes
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-08T14:40:03.343Z
Comments.Text: @jknappen Done!
Comments.UserDisplayName: Shreyas
Tags: <engines><perft>
Title: Is there a chess engine with divide perft for captures only?
ThreadText: # Is there a chess engine with divide perft for captures only?
  
  (Asked by: username_0 on 2015-12-07)
  
  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](https://chessprogramming.wikispaces.com/Perft+Results)*.
  
  ***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](http://bluefever.net/Downloads/ViceReadMe.html)* 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.
  
  **Tags:** engines, perft
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_0**: @jknappen Done!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-12-08. Score: 1 | Accepted answer
  
  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.
  
  
  ---
  
  ### Answer by username_3 on 2024-06-02. Score: 0
  
  Actually I had a similar (same?) problem while writing my engine. It has a function in it that generates perft for tactical moves (so captures and promotions; any material-changing move).
  It seems to be working but I've never really bothered crosschecking it against other engine.
  If you (or anyone) still wants to use it you can look it up here:
  <https://github.com/macsmol/machess>
  
  Two remarks:
  
  1. The function is there inside the engine (see method tacticalMoveGenerationTest() in StateTest.java) but not really exposed to the end user. Let me know if you want me to add it.
  2. Implementation details:
  
     -The function does normal perft except at the maximum depth it generates only tactical moves.
  
     -if a move is a promotion and a capture at the same time then it is counted as one move. So capturing with white pawn on a8 gives 4 moves (every promotions).
  
  
  ---
  
  