Answers.Body: <p>White hasn't lost his castling rights. It's just not a legal move right now. There is a distinction.</p>
  <p>White would still be able to castle king-side, if the bishop were to move.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-17T16:20:10.843Z
Answers.LastActivityDate: 2020-06-17T16:20:10.843Z
Answers.UserDisplayName: Herb
Body: <p>In <a href="http://www.talkchess.com/forum3/viewtopic.php?p=575819&amp;sid=604f7301762ea0d2f4cb746657e2a379#p575819" rel="nofollow noreferrer">this talkchess thread</a>, they discuss trapped rooks and castling rights. In post #5, user @Lyudmil Tsvetkov posted:</p>
  <blockquote>
  <p>I would give at least some 10-15cps for temporary prevention of castling.</p>
  </blockquote>
  <p>Here is <a href="https://github.com/official-stockfish/Stockfish/blob/995ee4b31105ad8c7976cc68c11fabfdc5108e63/src/evaluate.cpp#L366" rel="nofollow noreferrer">how</a> StockFish implements it:</p>
  <pre><code>score -= TrappedRook * (1 + !pos.castling_rights(Us));
  </code></pre>
  <p>Here an example position.</p>
  <pre><code>r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PPBP/R1B1K2R w Kq - 0 1
  </code></pre>
  <p>When searching, the move Bg2-f1 leads to the position.</p>
  <pre><code>r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PP1P/R1B1KB1R b Kq - 1 1
  </code></pre>
  <p>As you can see, the White bishop has blocked castling, but <code>pos.castling_rights(Us)</code> for White still returns true, which means Stockfish is not penalizing for the temporary prevention of castling.</p>
  <p>Is it intentional or is it a Stockfish bug?</p>
  
Tags: <stockfish><programming><castling><evaluation><rooks>
Title: Trapped Rooks: Does Stockfish penalize more if the king can't castle temporarily?
ThreadText: # Trapped Rooks: Does Stockfish penalize more if the king can't castle temporarily?
  
  (Asked by: username_0 on 2020-06-17)
  
  In this talkchess thread, they discuss trapped rooks and castling rights. In post #5, user @Lyudmil Tsvetkov posted:
  
  I would give at least some 10-15cps for temporary prevention of castling.
  
  Here is how StockFish implements it:
  score -= TrappedRook * (1 + !pos.castling_rights(Us));
  
  Here an example position.
  r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PPBP/R1B1K2R w Kq - 0 1
  
  When searching, the move Bg2-f1 leads to the position.
  r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PP1P/R1B1KB1R b Kq - 1 1
  
  As you can see, the White bishop has blocked castling, but pos.castling_rights(Us) for White still returns true, which means Stockfish is not penalizing for the temporary prevention of castling.
  Is it intentional or is it a Stockfish bug?
  
  **Tags:** stockfish, programming, castling, evaluation, rooks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-17. Score: 1
  
  White hasn't lost his castling rights. It's just not a legal move right now. There is a distinction.
  
  White would still be able to castle king-side, if the bishop were to move.
  
  
  ---
  
  