Answers.Body: <p>I think this is due, at least in part, to the horizon effect.</p>
  <p>I first used Stockfish 14 with depth 20 (in Lucas Chess).</p>
  <p>After 1. d5 cxd6 2. cxd5 Bxd5 3. Bf5 Nb6 4. Bxf6+ Ke8 5. Bg6+ Kf8 6. Rf7+ Kg8 7. Rg7+ Kf8, Stockfish 14, using depth 20, rates Rc7 best, at +7.45, with the line</p>
  <ol start="8">
  <li>Rc7 Kg8 9. Rg7+ Kf8 10. Re7 Bc6 11. Rc7 Kg8 12. Bf5 Bd5 13. Bd4 h5 14. Bxh8 Kxh8 15. Rh7+ Kg8 16. Rxh5 Kf7 17. Rxg5 a5 18. Bb1 a4 19. b4 Bxa2</li>
  </ol>
  <p>The position after 9. Rg7+ Kf8 there is the same. So why not 8 Re7 immediately? Stockfish rates  8 Re7 +6.85, with the line</p>
  <ol start="8">
  <li>Re7 Bc6 9. Rc7 Kg8 10. Bf5 Bd5 11. Bd4 h5 12. Bxh8 Kxh8 13. Rh7+ Kg8 14. Rxh5 Kf7 15. Rxg5 Bc6 {different}</li>
  </ol>
  <p>and eventually 21. h7 Nxh7. That is, Stockfish now sees Black's capture of White's h-pawn, which it missed before.</p>
  <p>If Stockfish's maximum depth is increased from 20 to 24, Stockfish still see Rc7 as best, but now its line is</p>
  <ol start="8">
  <li>Rc7 Kg8 9. Bd4 Bc6 10. Bf7+ Kf8 11. Be6 Nd7 12. Bxd7 Bxd7 13. Rxd7 Rg8 14. Bc5+ Ke8 15. Re7+ Kd8 16. Rxb7 Kc8 17. Rxa7 Kb8 18. Rh7 Rd8 19. Ke2 Re8+ 20. Kd2 Rd8+ 21. Kc3 g4 22. hxg4 Rg8 23. Bd6+ Kc8 24. Bxf4 Rxg4</li>
  </ol>
  <p>avoiding repetition, bringing White's king closer to the scene of action and with more captures before the horizon, which suggests that still deeper analysis is needed. With depth 27, it sees the above line, but deviating with</p>
  <ol start="16">
  <li>Rxb7 Rg6 17. Rxa7 h5 18. a4 g4 19. h4 Kc8 20. Rf7 f3 21. gxf3 gxf3 22. a5 Rg2+ 23. Kxf3 Rh2 24. Kg3</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-31T10:53:33.080Z
Answers.Text: This obviously calls for a follow-up question: Did a computer ever repeated moves *forever* because the concrete win lie over the horizon and the short-term repeat benefit was higher than the actual winning line?
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-30T07:45:44.183Z
Answers.LastActivityDate: 2021-08-30T07:45:44.183Z
Answers.UserDisplayName: Rosie F
Body: <p><a href="https://hamburger-schachverband.de/berichte/2021/ll.htm" rel="nofollow noreferrer">Where I observed it</a></p>
  <pre><code>[FEN &quot;3k3r/pp1n2R1/2p1bp1p/6p1/2PP1p2/1PBB3P/P4KP1/8 w KQkq - 0 1&quot;]
  
  1.d5 cxd5 2.cxd5 Bxd5 3.Bf5 Nb6 4.Bxf6+ Ke8 5.Bg6+ Kf8 6.Re7 Bc6 7.Rf7+ Kg8
  </code></pre>
  <p>I was using Stockfish/Lichess to analyze 1.d5 cxd5 2.cxd5 Bxd5 3.Bf5 Nb6 (a very silly try to avoid immediate material loss) 4.Bxf6+ Ke8 5.Bg6+ Kf8 6.Re7 Bc6 7.Rf7+ Kg8. I always played out the preferred computer move after a second or two, which lead to the computer repeating moves a few times, trying e.g. Rg7+ followed by Rf7+ or Rc7 first (where I simply would have gobbled the exchange).</p>
  <p>This behavior is straight impossible (by game theory) for a &quot;god&quot; computer. My only half-baked explanation is that the computer acts exactly like a human: hey, there must be some mate, let's repeat moves to gain time for analyzing a bit deeper. (But the analysis mode of Lichess doesn't involve time anyway?!)</p>
  <p>Can a computer expert tell me why a computer repeats moves in a won position?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-29T16:24:28.230Z
Comments.Text: I'm not clear what the question is here. Lichess displays the possible moves in descending order of their evaluation by Stockfish. If two moves have the same evaluation, I don't know how Lichess decides which order to display them in, but maybe it's just arbitrary.
Comments.UserDisplayName: James Martin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-29T16:26:54.037Z
Comments.Text: What do you mean by "This behavior is straight impossible (by game theory) for a "god" computer"? Unless one somehow scores more highly for winning without repeating moves, then it seems perfectly fine to repeat moves along the way to winning. You might like to program your engine to play for the quickest win, but I don't know of anything in "game theory" that says you're obliged to! Perhaps Stockfish does indeed try to play for the quickest win; for that you could try watching Stockfish play, rather than just asking it for a numerical evaluation of the position after each possible next move.
Comments.UserDisplayName: James Martin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-30T07:47:50.640Z
Comments.Text: @JamesMartin: I claimed *merely* that a repeating move can't have a higher evaluation than the quickest win. (I see what you mean, a "god" computer only has evaluations of +1,0,-1, so nothing speaks against repeating moves.)
Comments.UserDisplayName: Hauke Reddmann
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-31T05:43:18.633Z
Comments.Text: @JamesMartin If we assume that the computer orders moves first by W/D/L, and then by length of game, a win with repeated moves would be ranked lower than one without.
Comments.UserDisplayName: Acccumulation
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-31T10:12:40.077Z
Comments.Text: @Acccumulation Agree! - if you prefer quick wins to slow wins, you will prefer not to repeat moves on the way. In the case of "L", I guess you prefer slow losses to quick losses - and what is your protocol in the case of "D"?
Comments.UserDisplayName: James Martin
Tags: <engines>
Title: Computer repeating moves?
ThreadText: # Computer repeating moves?
  
  (Asked by: username_0 on 2021-08-29)
  
  [Where I observed it](https://hamburger-schachverband.de/berichte/2021/ll.htm)
  
  ```
  [FEN "3k3r/pp1n2R1/2p1bp1p/6p1/2PP1p2/1PBB3P/P4KP1/8 w KQkq - 0 1"]
  
  1.d5 cxd5 2.cxd5 Bxd5 3.Bf5 Nb6 4.Bxf6+ Ke8 5.Bg6+ Kf8 6.Re7 Bc6 7.Rf7+ Kg8
  
  ```
  
  I was using Stockfish/Lichess to analyze 1.d5 cxd5 2.cxd5 Bxd5 3.Bf5 Nb6 (a very silly try to avoid immediate material loss) 4.Bxf6+ Ke8 5.Bg6+ Kf8 6.Re7 Bc6 7.Rf7+ Kg8. I always played out the preferred computer move after a second or two, which lead to the computer repeating moves a few times, trying e.g. Rg7+ followed by Rf7+ or Rc7 first (where I simply would have gobbled the exchange).
  
  This behavior is straight impossible (by game theory) for a "god" computer. My only half-baked explanation is that the computer acts exactly like a human: hey, there must be some mate, let's repeat moves to gain time for analyzing a bit deeper. (But the analysis mode of Lichess doesn't involve time anyway?!)
  
  Can a computer expert tell me why a computer repeats moves in a won position?
  
  **Tags:** engines
  
  > **Comments:**
  > **username_1**: I'm not clear what the question is here. Lichess displays the possible moves in descending order of their evaluation by Stockfish. If two moves have the same evaluation, I don't know how Lichess decides which order to display them in, but maybe it's just arbitrary.  
  > **username_1**: What do you mean by "This behavior is straight impossible (by game theory) for a "god" computer"? Unless one somehow scores more highly for winning without repeating moves, then it seems perfectly fine to repeat moves along the way to winning. You might like to program your engine to play for the quickest win, but I don't know of anything in "game theory" that says you're obliged to! Perhaps Stockfish does indeed try to play for the quickest win; for that you could try watching Stockfish play, rather than just asking it for a numerical evaluation of the position after each possible next move.  
  > **username_0**: @username_1: I claimed *merely* that a repeating move can't have a higher evaluation than the quickest win. (I see what you mean, a "god" computer only has evaluations of +1,0,-1, so nothing speaks against repeating moves.)  
  > **username_2**: @username_1 If we assume that the computer orders moves first by W/D/L, and then by length of game, a win with repeated moves would be ranked lower than one without.  
  > **username_1**: @username_2 Agree! - if you prefer quick wins to slow wins, you will prefer not to repeat moves on the way. In the case of "L", I guess you prefer slow losses to quick losses - and what is your protocol in the case of "D"?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2021-08-30. Score: 2 | Accepted answer
  
  I think this is due, at least in part, to the horizon effect.
  
  I first used Stockfish 14 with depth 20 (in Lucas Chess).
  
  After 1. d5 cxd6 2. cxd5 Bxd5 3. Bf5 Nb6 4. Bxf6+ Ke8 5. Bg6+ Kf8 6. Rf7+ Kg8 7. Rg7+ Kf8, Stockfish 14, using depth 20, rates Rc7 best, at +7.45, with the line
  
  8. Rc7 Kg8 9. Rg7+ Kf8 10. Re7 Bc6 11. Rc7 Kg8 12. Bf5 Bd5 13. Bd4 h5 14. Bxh8 Kxh8 15. Rh7+ Kg8 16. Rxh5 Kf7 17. Rxg5 a5 18. Bb1 a4 19. b4 Bxa2
  
  The position after 9. Rg7+ Kf8 there is the same. So why not 8 Re7 immediately? Stockfish rates 8 Re7 +6.85, with the line
  
  8. Re7 Bc6 9. Rc7 Kg8 10. Bf5 Bd5 11. Bd4 h5 12. Bxh8 Kxh8 13. Rh7+ Kg8 14. Rxh5 Kf7 15. Rxg5 Bc6 {different}
  
  and eventually 21. h7 Nxh7. That is, Stockfish now sees Black's capture of White's h-pawn, which it missed before.
  
  If Stockfish's maximum depth is increased from 20 to 24, Stockfish still see Rc7 as best, but now its line is
  
  8. Rc7 Kg8 9. Bd4 Bc6 10. Bf7+ Kf8 11. Be6 Nd7 12. Bxd7 Bxd7 13. Rxd7 Rg8 14. Bc5+ Ke8 15. Re7+ Kd8 16. Rxb7 Kc8 17. Rxa7 Kb8 18. Rh7 Rd8 19. Ke2 Re8+ 20. Kd2 Rd8+ 21. Kc3 g4 22. hxg4 Rg8 23. Bd6+ Kc8 24. Bxf4 Rxg4
  
  avoiding repetition, bringing White's king closer to the scene of action and with more captures before the horizon, which suggests that still deeper analysis is needed. With depth 27, it sees the above line, but deviating with
  
  16. Rxb7 Rg6 17. Rxa7 h5 18. a4 g4 19. h4 Kc8 20. Rf7 f3 21. gxf3 gxf3 22. a5 Rg2+ 23. Kxf3 Rh2 24. Kg3
  
  > **Comments:**
  > **username_0**: This obviously calls for a follow-up question: Did a computer ever repeated moves *forever* because the concrete win lie over the horizon and the short-term repeat benefit was higher than the actual winning line?  
  
  ---
  
  