Answers.Body: <p>Chess engines always consider the &quot;best move&quot; possible for both side. What the &quot;best move&quot; means, is the best move found from the engine according to its evaluation function, selection algorithms, pruning and so on. But no, they don't have a sense of &quot;possible error&quot;. Because engine evluated a checkmated position with a score plus the distance-to-mate, every engine choose the move that leads to the longest line possible to be checkmated as it will have the highest score found. Assuming no bugs in the engine, of course.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-24T18:14:50.193Z
Answers.LastActivityDate: 2023-10-24T18:14:50.193Z
Answers.UserDisplayName: user36047
Body: <p>Essentially, do Chess Engines acknowledge that their opponents might make &quot;flawed&quot; moves? Or do they always assume absolutely perfect play.</p>
  <p>More specifically, if an engine has a choice between 2 moves and one of them is:</p>
  <ul>
  <li>Mate in 5, with perfect play, all of which is completely obvious</li>
  </ul>
  <p>and the other is</p>
  <ul>
  <li>Mate in 4 ... but only if the opponent does something superficially counter-intuitive. And if they do the superficially obvious thing then you can actually escape the Mating sequence into a not-directly Mated position</li>
  </ul>
  <p>If you assume perfect play, then both positions are a loss, and I assume that engines are &quot;taught&quot; to pick the longest game if all games are lost.</p>
  <p>But I would argue that if you believe the game is lost either way, you might want to pick the line with highest chance of an error, instead?</p>
  <p>Do engines do that?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-10-24T16:13:47.320Z
Comments.Text: Bear in mind of course, that anything that isn't an end-base board ... "perfect play" isn't objectively known ... only heuristically guessed by incredibly accurate computers, which sometimes disagree.
Comments.UserDisplayName: Brondahl
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-10-24T17:54:02.933Z
Comments.Text: How does one figure out what the chance of error is?  Isn't that a question of psychology rather than chess?  How would we teach an engine psychology?
Comments.UserDisplayName: Alexander Woo
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-10-24T20:35:56.143Z
Comments.Text: If the engine sees two moves, and one of them leads to a forced M4 against it and the other leads to M5, it will always choose the M5 one. Engines use the minimax algorithm, which assumes perfect play by both sides; they don't play "hope chess". Technically though, the engine might go for the M4 continuation if the move really were really hard to see and the engine itself missed it (due to pruning).
Comments.UserDisplayName: Hank's back rank
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-10-25T07:56:30.067Z
Comments.Text: `How does one [teach the enginge] what the chance of error is?` Exactly the same way you teach it every other thing ... data. Feed it 100M games and let it work out what kinds of errors are more/less common. Hell ... if you give it the player's rankings it can probably figure out classes of error by ranking range, and estimate the range of its opponent on the fly.
Comments.UserDisplayName: Brondahl
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-10-25T19:34:52.050Z
Comments.Text: Such an engine would be possible with enough data, maybe as a "fun engine" use-case. Personally I don't know of one.
Comments.UserDisplayName: Hauke Reddmann
Tags: <engines><endgame>
Title: In a completely lost position do chess engines attempt to bait their opponent into mistakes, or just play for the longest survival?
ThreadText: # In a completely lost position do chess engines attempt to bait their opponent into mistakes, or just play for the longest survival?
  
  (Asked by: username_0 on 2023-10-24)
  
  Essentially, do Chess Engines acknowledge that their opponents might make "flawed" moves? Or do they always assume absolutely perfect play.
  
  More specifically, if an engine has a choice between 2 moves and one of them is:
  
  * Mate in 5, with perfect play, all of which is completely obvious
  
  and the other is
  
  * Mate in 4 ... but only if the opponent does something superficially counter-intuitive. And if they do the superficially obvious thing then you can actually escape the Mating sequence into a not-directly Mated position
  
  If you assume perfect play, then both positions are a loss, and I assume that engines are "taught" to pick the longest game if all games are lost.
  
  But I would argue that if you believe the game is lost either way, you might want to pick the line with highest chance of an error, instead?
  
  Do engines do that?
  
  **Tags:** engines, endgame
  
  > **Comments:**
  > **username_0**: Bear in mind of course, that anything that isn't an end-base board ... "perfect play" isn't objectively known ... only heuristically guessed by incredibly accurate computers, which sometimes disagree.  
  > **username_1**: How does one figure out what the chance of error is?  Isn't that a question of psychology rather than chess?  How would we teach an engine psychology?  
  > **username_2**: If the engine sees two moves, and one of them leads to a forced M4 against it and the other leads to M5, it will always choose the M5 one. Engines use the minimax algorithm, which assumes perfect play by both sides; they don't play "hope chess". Technically though, the engine might go for the M4 continuation if the move really were really hard to see and the engine itself missed it (due to pruning).  
  > **username_0**: `How does one [teach the enginge] what the chance of error is?` Exactly the same way you teach it every other thing ... data. Feed it 100M games and let it work out what kinds of errors are more/less common. Hell ... if you give it the player's rankings it can probably figure out classes of error by ranking range, and estimate the range of its opponent on the fly.  
  > **username_3**: Such an engine would be possible with enough data, maybe as a "fun engine" use-case. Personally I don't know of one.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_4 on 2023-10-24. Score: 5
  
  Chess engines always consider the "best move" possible for both side. What the "best move" means, is the best move found from the engine according to its evaluation function, selection algorithms, pruning and so on. But no, they don't have a sense of "possible error". Because engine evluated a checkmated position with a score plus the distance-to-mate, every engine choose the move that leads to the longest line possible to be checkmated as it will have the highest score found. Assuming no bugs in the engine, of course.
  
  
  ---
  
  