Answers.Body: <p>Stockfish isn't a perfect chess-playing entity, and you've found a position where it's unable to tell is a draw (at least until the 50 move rule kicks in and helps it prune). These positions are called "<a href="https://www.chessprogramming.org/Fortress" rel="noreferrer">fortresses</a>". You can tell this is happening because even if you input the solution, Stockfish still evaluates the final position as -10 or more. These fortress positions where Stockfish is dead wrong are few and far between, but they exist, and this is one of them.</p>
  
  <p>There've been various attempts at writing fortress detection code in Stockfish and other conventional engines which are meant to recognize fortresses and stop Stockfish from heading for them if its position is superior. If you have a smart idea, you can probably publish it in an academic journal (see the publications in the chessprogramming wiki).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-20T07:36:27.173Z
Answers.Text: https://www.chessprogramming.org/Crystal is a variant of Stockfish that tries to solve tricky positions like fortresses
Answers.UserDisplayName: qwr
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-07T21:29:54.543Z
Answers.LastActivityDate: 2019-07-07T21:29:54.543Z
Answers.UserDisplayName: Allure
Answers.Body: <p>It helps to understand that engines don't really go off of "strategy", so much as they look several moves into the future, evaluate the score of the position, and find the optimal move set.</p>
  
  <p>The great weakness of that approach is that if nothing can happen quickly, the engine's going to have problems.  This used to be a <em>huge</em> problem with endgames.  If you've got a K+B+P vs K+P, you're not resolving that position in just a few moves.  So the fix was to add Endgame Tablebases to the engines - just bruteforce calculate every endgame position ahead of time and add them as a library for the engine to use.  (This is why, in most cheap chess apps, you can earn a win simply by surviving to the endgame: because it doesn't have an endgame tablebase.)</p>
  
  <p>But your position is (understandably) not going to be in any endgame tablebase.  So stockfish has to play out millions of positions, stretching 10 or so moves into the future... only to find that in all of them, black is substantially up in material.  It definitely can't play out ~56 moves for the full decision tree - which is what it would take to determine a definitive draw.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-08T16:25:34.593Z
Answers.LastActivityDate: 2019-07-08T16:25:34.593Z
Answers.UserDisplayName: Kevin
Answers.Body: <p>The other answers cover this question well, but it is interesting that not all programs do not understand this is a draw. I plugged this into my computer, and as a ChessBase Premium member, I also have access to cloud engines.</p>
  
  <p>One of those cloud engines evaluated this as a draw almost instantaneously. I only wish there were more information than simply "New Engine".</p>
  
  <p><a href="https://i.sstatic.net/gxy8x.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gxy8x.png" alt="enter image description here"></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-12T22:15:30.570Z
Answers.Text: The reason that one engine evaluated it as draw is probably because it has that exact position in its cloud database solved as a draw. This position is actually a chess composition that I remember seeing in some book. This is why it might appear in a database, although it's not a position that naturally occured in a game, and the probability of that happening is pretty low.
Answers.UserDisplayName: neondrop
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-28T13:08:13.907Z
Answers.LastActivityDate: 2019-12-28T13:08:13.907Z
Answers.UserDisplayName: PhishMaster
Body: <p>This is the study</p>
  
  <pre><code>[fen "3B4/1r2p3/r2p1p2/bkp1P1p1/1p1P1PPp/p1P4P/PPBK4/8 w - - 0 1 "]
  </code></pre>
  
  <p>As you can see, Stockfish gives an absolute decisive win for black, though it is clearly a draw!!</p>
  
  <p><a href="https://lichess.org/study/sANfn6M8" rel="noreferrer">Check it out yourself</a></p>
  
  <p>c4+ is a losing move, while Ba4+ is the correct one.</p>
  
  <p>What's going on? Doesn't Stockfish take into consideration closed positions <strong>at all</strong>?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T01:11:36.767Z
Comments.Text: There are lots of positions that Stockfish doesn't evaluate correctly (including some common endgames).
Comments.UserDisplayName: Qudit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T08:43:24.813Z
Comments.Text: Happens all the time! It's a piece of software, not a God
Comments.UserDisplayName: David
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T10:17:56.943Z
Comments.Text: It would make me quite happy to see a scenario in a similar vein that's assessed completely wrong by AlphaZero or Leela Zero!
Comments.UserDisplayName: leftaroundabout
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T18:39:47.000Z
Comments.Text: Stockfish certainly sees the position after 1.Ba4+ Kxa4 2.b3+ Kb5 3.c4+ Kc6 4.d5+ Kd7 5.e6+ any 6.f5. It's only eleven ply. So the real question is: why doesn't Stockfish see that the position after 6.f5 is a draw?
Comments.UserDisplayName: TonyK
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T18:44:27.830Z
Comments.Text: @TonyK That's because Stockfish doesn't understand that black can never break through.  It just sees that it is down a ton of material.  Stockfish evaluations are based on calculation.  It doesn't understand that the pawn structure is locked and material doesn't matter.
Comments.UserDisplayName: Qudit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T19:06:08.887Z
Comments.Text: @Qudit: Yes. I was just pointing out that the question should focus on precisely this aspect, rather than starting from the position as given. Sorry if I didn't make that clear.
Comments.UserDisplayName: TonyK
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T20:34:26.370Z
Comments.Text: Hmm my local installation of stockfish 10 is giving me e5f6 on same depth. wonder what is the source of the difference
Comments.UserDisplayName: OganM
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-09T01:05:15.493Z
Comments.Text: @leftaroundabout Leela misevaluates fortresses all the time as well, see e.g. the end of this game from the TCEC Sufi: https://cd.tcecbeta.club/archive.html?season=15&div=sf&game=31. In fact arguably Leela misevaluates even more than Stockfish, since quite often it will have some nonzero eval while Stockfish stoically displays 0.00, and it takes ages before Leela realizes the opponent is not letting it win.
Comments.UserDisplayName: Allure
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-09T14:03:35.087Z
Comments.Text: Rule of thumb: If Stockfish doesn't change the evaluation score *at all* for 10-20+ moves (in this case staying at exactly -18.1), it has most likely found a fortress.
Comments.UserDisplayName: Annatar
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-11T21:04:49.750Z
Comments.Text: I find this laughable. You are getting all upset about a program rated 3450, 600+ points higher than the best human player the world has ever seen, because it cannot see a draw in a position that would never occur in real life.
Comments.UserDisplayName: Randy Minder
Tags: <engines><stockfish><closed-position><studies>
Title: Bad Stockfish evaluation
ThreadText: # Bad Stockfish evaluation
  
  (Asked by: username_0 on 2019-07-07)
  
  This is the study
  [fen "3B4/1r2p3/r2p1p2/bkp1P1p1/1p1P1PPp/p1P4P/PPBK4/8 w - - 0 1 "]
  
  As you can see, Stockfish gives an absolute decisive win for black, though it is clearly a draw!!
  Check it out yourself
  c4+ is a losing move, while Ba4+ is the correct one.
  What's going on? Doesn't Stockfish take into consideration closed positions at all?
  
  **Tags:** engines, stockfish, closed-position, studies
  
  > **Comments:**
  > **username_1**: There are lots of positions that Stockfish doesn't evaluate correctly (including some common endgames).  
  > **username_2**: Happens all the time! It's a piece of software, not a God  
  > **username_3**: It would make me quite happy to see a scenario in a similar vein that's assessed completely wrong by AlphaZero or Leela Zero!  
  > **username_4**: Stockfish certainly sees the position after 1.Ba4+ Kxa4 2.b3+ Kb5 3.c4+ Kc6 4.d5+ Kd7 5.e6+ any 6.f5. It's only eleven ply. So the real question is: why doesn't Stockfish see that the position after 6.f5 is a draw?  
  > **username_1**: @username_4 That's because Stockfish doesn't understand that black can never break through.  It just sees that it is down a ton of material.  Stockfish evaluations are based on calculation.  It doesn't understand that the pawn structure is locked and material doesn't matter.  
  > **username_4**: @username_1: Yes. I was just pointing out that the question should focus on precisely this aspect, rather than starting from the position as given. Sorry if I didn't make that clear.  
  > **username_5**: Hmm my local installation of stockfish 10 is giving me e5f6 on same depth. wonder what is the source of the difference  
  > **username_6**: @username_3 Leela misevaluates fortresses all the time as well, see e.g. the end of this game from the TCEC Sufi: https://cd.tcecbeta.club/archive.html?season=15&div=sf&game=31. In fact arguably Leela misevaluates even more than Stockfish, since quite often it will have some nonzero eval while Stockfish stoically displays 0.00, and it takes ages before Leela realizes the opponent is not letting it win.  
  > **username_7**: Rule of thumb: If Stockfish doesn't change the evaluation score *at all* for 10-20+ moves (in this case staying at exactly -18.1), it has most likely found a fortress.  
  > **username_8**: I find this laughable. You are getting all upset about a program rated 3450, 600+ points higher than the best human player the world has ever seen, because it cannot see a draw in a position that would never occur in real life.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_6 on 2019-07-07. Score: 27
  
  Stockfish isn't a perfect chess-playing entity, and you've found a position where it's unable to tell is a draw (at least until the 50 move rule kicks in and helps it prune). These positions are called "[fortresses](https://www.chessprogramming.org/Fortress)". You can tell this is happening because even if you input the solution, Stockfish still evaluates the final position as -10 or more. These fortress positions where Stockfish is dead wrong are few and far between, but they exist, and this is one of them.
  
  There've been various attempts at writing fortress detection code in Stockfish and other conventional engines which are meant to recognize fortresses and stop Stockfish from heading for them if its position is superior. If you have a smart idea, you can probably publish it in an academic journal (see the publications in the chessprogramming wiki).
  
  > **Comments:**
  > **username_9**: https://www.chessprogramming.org/Crystal is a variant of Stockfish that tries to solve tricky positions like fortresses  
  
  ---
  
  ### Answer by username_10 on 2019-07-08. Score: 12
  
  It helps to understand that engines don't really go off of "strategy", so much as they look several moves into the future, evaluate the score of the position, and find the optimal move set.
  
  The great weakness of that approach is that if nothing can happen quickly, the engine's going to have problems. This used to be a *huge* problem with endgames. If you've got a K+B+P vs K+P, you're not resolving that position in just a few moves. So the fix was to add Endgame Tablebases to the engines - just bruteforce calculate every endgame position ahead of time and add them as a library for the engine to use. (This is why, in most cheap chess apps, you can earn a win simply by surviving to the endgame: because it doesn't have an endgame tablebase.)
  
  But your position is (understandably) not going to be in any endgame tablebase. So stockfish has to play out millions of positions, stretching 10 or so moves into the future... only to find that in all of them, black is substantially up in material. It definitely can't play out ~56 moves for the full decision tree - which is what it would take to determine a definitive draw.
  
  
  ---
  
  ### Answer by username_11 on 2019-12-28. Score: 0
  
  The other answers cover this question well, but it is interesting that not all programs do not understand this is a draw. I plugged this into my computer, and as a ChessBase Premium member, I also have access to cloud engines.
  
  One of those cloud engines evaluated this as a draw almost instantaneously. I only wish there were more information than simply "New Engine".
  
  [![enter image description here](https://i.sstatic.net/gxy8x.png)](https://i.sstatic.net/gxy8x.png)
  
  > **Comments:**
  > **username_12**: The reason that one engine evaluated it as draw is probably because it has that exact position in its cloud database solved as a draw. This position is actually a chess composition that I remember seeing in some book. This is why it might appear in a database, although it's not a position that naturally occured in a game, and the probability of that happening is pretty low.  
  
  ---
  
  