Answers.Body: <blockquote>
  <p>Why don't chess engines take into account the time left by each player?</p>
  </blockquote>
  <p>For the simple reason that there is no way of knowing how to do that.</p>
  <p>A few years ago a clubmate rated about 1800 playing in the British Universities blitz (3+2) championships reached a KNB v K endgame. He knew the endgame and so blitzed out the win. I have other clubmates rated 2100+ who don't know that endgame and would not be able to checkmate in such period of time. Give them 20 minutes on the clock and they still might not succeed. There have been cases of IMs failing to do this at regular time controls.</p>
  <p>In short it is an impossible task.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-16T06:09:19.110Z
Answers.Text: "no way of knowing how to do that" Umm, 
  In games between engines, the evaluation tend to zero. But between engine and persons, I believe that the engine's best play is the move that demands more precision to support the position or gain an advantage. Its the style, "introduce complications". This style of game will be more effective when the person lacks enough time to think.
Answers.UserDisplayName: djnavas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-16T22:57:40.423Z
Answers.Text: @djnavas Engines aren't always good at dealing with complications, either.
Answers.UserDisplayName: wizzwizz4
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-13T20:56:20.720Z
Answers.LastActivityDate: 2022-11-14T14:29:45.307Z
Answers.LastEditDate: 2022-11-14T14:29:45.307Z
Answers.UserDisplayName: Brian Towers
Answers.Body: <p>Because engines find the best move by assuming best play, not by hoping their opponent makes an inferior move.</p>
  <p>If you constructed an engine whose sole purpose was to beat a specific person/engine, then &quot;likelihood to play a given bad move&quot; could make sense as an evaluation parameter.  But otherwise it's a waste of time to calculate something that would ultimately lead to the engine playing weaker moves.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T11:00:41.483Z
Answers.Text: One *might* conceivably come up with a metric how hard it is to find that best move in a given time. One simple way to do that is to let *the engine itself* compare e.g. a static evaluation vs. the result of a regular n-ply search, while taking into account the number of moves retaining most of the equity ("OK moves", including the correct one) vs. "wrong" moves. I think there is a consensus that positions that have only one correct move are hard, especially if that move isn't obvious (e.g. detected by a static eval). Finding it may take time or genius.
Answers.UserDisplayName: Peter - Reinstate Monica
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T11:38:37.263Z
Answers.Text: +1 correct answer.
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T15:24:31.637Z
Answers.Text: This is not 100% percent true, actually there is something called "contempt factor" which allows a bias toward assumed weaker players.  See https://www.chessprogramming.org/Contempt_Factor
Answers.UserDisplayName: CaptainCodeman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T00:07:28.717Z
Answers.Text: @CaptainCodeman: Contempt is more about whether the engine should avoid (early) draws in an even position, not about whether the opponent will see the only good move. No reasonable engine should accept a draw when the evaluation is +5 in its favor, regardless of the contempt factor (within reason... I imagine there's some way of misconfiguring an engine so that it will behave in such a way, but that's not a "reasonable engine" anymore).
Answers.UserDisplayName: Kevin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T05:11:23.200Z
Answers.Text: When I played competitively, we analyzed the games of my upcoming opponents, in order to find out which play styles they are good in and and in which ones are they more likely to make weaker moves. Tailoring gameplay for a specific opponent is not unheard of.
Answers.UserDisplayName: vsz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T05:17:58.783Z
Answers.Text: @vsz: Yes, that's extremely common for humans, as is the scenario mentioned by OP. It's also common for humans, even GMs, to prefer suboptimal moves to make the position easier, or even losing moves to make the position more complicated (Mikhail Tal was famous for that). But the question was about how computers play.
Answers.UserDisplayName: BlueRaja - Danny Pflughoeft
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T22:34:34.723Z
Answers.Text: More concisely, "Hoping for a misplay due to opponents rushing" is not optimal play.
Answers.UserDisplayName: Turbo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T23:35:55.460Z
Answers.Text: @Turbo: On the other hand, being able to observe and exploit misplays by the opponent is necessary for optimal play.  One thing that's interesting when looking at analysis of top-tier chess games, at least at moderately short time controls, is how often a player will make a move that leaves an opening for the opponent, but the opponent will fail to see it.
Answers.UserDisplayName: supercat
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T10:02:35.610Z
Answers.LastActivityDate: 2022-11-14T10:02:35.610Z
Answers.UserDisplayName: BlueRaja - Danny Pflughoeft
Answers.Body: <p>This is an exposition of BlueRaja - Danny Pflughoeft's answer, which is correct. Given the option between making 1) the objectively strongest move and 2) the one against which the best move is &quot;really hard to find&quot;, would you really rather an engine make move #2?</p>
  <p>Let's say you make move #2. If opponent doesn't find it, congrats, you win. If opponent does - then what? Did you just throw away your winning chances? Did you just go from losing to lost? If the answer to either of the above is &quot;yes&quot;, not only should an engine not make that move, a human should not make that move either!</p>
  <p>Example:</p>
  <pre><code>[FEN &quot;3r2k1/2pqnpp1/1p5p/p2P4/P2p1rP1/2P1N3/1PQ2PP1/3RR1K1 w - - 0 1&quot;]
  
  1. g3 dxe3 2. gxf4 Qxg4+
  </code></pre>
  <p>This position is from Nepomniatchi-Carlsen, World Chess Championship 2021. It is dead equal - 0.00 eval according to Stockfish. Stockfish's main line begins with 1. Rxd4 and leads to a draw. However, Nepo played 1. g3. Now when a piece comes under attack, the first inclination is to move it. Accordingly, the first move Carlsen is likely to look at is 1...Rf6. Look a bit further though, and Black will notice that 1...dxe3 wins (since 2. gxf4? Qxg4+ followed by a rook lift is a decisive attack).</p>
  <p><strong>Would you really rather an engine play 1. g3 instead of 1. Rxd4?</strong> Phrased alternatively, would you rather get a sure draw, or a &quot;maybe&quot; win that is a guaranteed loss if opponent sees the key move? Think about it. Nobody - engine or human - should prefer the latter.</p>
  <p>That said: engines do have a measure of how complex the current position is. If the engine believes it is stronger than its opponent, then it will try to steer the game towards more complex positions. Inferior opposition is more likely to blunder in those positions. That's how engines exploit their opponents.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T13:31:07.633Z
Answers.Text: It doesn't have to be about what the engine plays but what it communicates to us humans. Personally I would think it would be pretty cool if an engine could rate the best line not just in centipawns but also provide some rating how hard this is to find for a human. There could be a lot of educational use in that.
Answers.UserDisplayName: blues
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T21:01:36.580Z
Answers.Text: If one is using a computer as a sparring partner, having it occasionally make sub-optimal moves may be a useful form of practice.  At rapid time controls, even games between top-tier players will often feature multiple mistakes which could have changed the result by a half point if exploited, but which weren't noticed until post-game analysis.  Thus, an ability to exploit mistakes may be an extremely valuable skill, but one which couldn't be practiced very well if one only took on "perfect" opponents.
Answers.UserDisplayName: supercat
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T07:45:15.363Z
Answers.Text: So "Don't set traps" and "Don't play 'hope chess'", then?
Answers.UserDisplayName: Rosie F
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T07:51:31.653Z
Answers.Text: @RosieF I think that's a nice way of putting it. If you make an objectively inferior move hoping that the opponent will not spot it because of their time situation, then it's hope chess and it's something chess trainers try to dissuade their students from. It doesn't mean you shouldn't set traps, but it does mean that you should assume your opponent will see the trap and avoid it, in which case your move is still good.
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T07:59:50.783Z
Answers.Text: If a move is good (even if it isn't the best option), I'd say that it doesn't count as setting a trap. If your opponent then plays a move which enables you to get a position akin to your springing a trap, then what you did wasn't a trap, but punishing your opponent's blunder.
Answers.UserDisplayName: Rosie F
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-16T07:45:56.163Z
Answers.Text: *"That said: engines do have a measure of how complex the current position is."* Do you have a reference for this?
Answers.UserDisplayName: Mateen Ulhaq
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-16T07:56:18.713Z
Answers.Text: @MateenUlhaq check out Stockfish's code here: https://github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp#L1065 There is a variable called "complexity", which is supposed to measure the complexity of the position. The NNUE complexity is hard to interpret, but the classical one is relatively straightforward. I can go into more detail if you like.
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T12:06:18.273Z
Answers.LastActivityDate: 2022-11-14T12:27:33.317Z
Answers.LastEditDate: 2022-11-14T12:27:33.317Z
Answers.UserDisplayName: Allure
Answers.Body: <p>Stockfish has 'wtime' and 'btime' options, that get it to calculate as if white and black only have such and such time left. However, in cases you're mentioning where human players only have a few seconds to find a move, even here Stockfish would most likely find the move under these wtime &amp; btime constraints.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-13T21:05:52.917Z
Answers.LastActivityDate: 2022-11-13T21:05:52.917Z
Answers.UserDisplayName: Inertial Ignorance
Answers.Body: <p>Position evaluation by an engine is completely objective.  Put any 2 players in a given position and the eval is the same.  Once you add the clock into the equation the evaluation becomes different depending on who the player is.  The objective evaluation becomes a subjective evaluation which no longer has any concrete meaning.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T19:10:06.103Z
Answers.LastActivityDate: 2022-11-15T19:10:06.103Z
Answers.UserDisplayName: Phil Gibson
Answers.Body: <p>because it adds another variable which exponentially increases the number of calculations needed, so it wouldn't be able to calculate to as much of a depth as without it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-16T06:58:15.747Z
Answers.Text: Chess moves are already an exponential variable and there are various ways to cut the number of calculations down. So, I believe a constant calculation of time variable would not change the overall complexity, while it might give some information. Can you elaborate on what you claimed? Why do you think it would be a significant increase? Please edit and explain your answer as it looks more like a comment than an answer currently.
Answers.UserDisplayName: Minot
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-22T23:09:22.867Z
Answers.Text: @Minot except it's not a constant calculation, you would have to consider the time left in each position, for it to be worthwhile you would have to search to a deeper depth to check if the move might actually be bad and then consider that they don't have "enough time" (a variable which changes based on so many things and would be extremely hard to calculate) and then after all that you'd be making your move based on the lower depth. which just doesn't make sense, so given the extra calculation time, just spend it on searching to deeper depth and just make the more 'correct' move.
Answers.UserDisplayName: Aequitas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-22T23:11:26.977Z
Answers.Text: maybe at most you could do it in the very late game as it's conceivable that given your opponent moving in the minimum time (usually 0.1 seconds?) there may be lines that are impossible to win from due to the time taken. Also at the late game with less pieces there's far less complexity so it's easier to incorporate.
Answers.UserDisplayName: Aequitas
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T23:22:00.963Z
Answers.LastActivityDate: 2022-11-15T23:22:00.963Z
Answers.UserDisplayName: Aequitas
Answers.Body: <p>Let me chime in too. The OP's question is really two in one, which were conflated a bit in the discussion.</p>
  <p>a) HOW can you implement it?</p>
  <p>b) WHY should you implement it?</p>
  <p>I see no reason why a) should be impossible. For example, the reknowned game-theory primer &quot;Winning Ways...&quot; gives a clear mathematical notion how &quot;hot&quot; a game is. You can come up with more metrics - the depth and with of the decision tree, how &quot;easy&quot; a winning move is etc. This will get very tricky and as always is probably easier done quick-and-dirty, but why not?</p>
  <p>But I see a problem with b). What is the &quot;use case&quot; of doing all the work? Computer vs Computer? Surely not. Computer vs Human? Aw cmon, they annihilate you anyway :-) This leaves: training. I'm just reading the &quot;Complete Chess Swindler&quot;, many games have been blundered in time trouble and someone like me who plays lightning fast <em>will</em> use it against you! Surely it can't hurt if you train finding the best move under time strain. But even in this case, I think pre-chosen positions are much more effective in training than random played games.</p>
  <p>Thus my verdict is: Nice-to-have feature, but lousy ROI to make one doing the programming work.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T13:58:16.177Z
Answers.Text: Perhaps b) as a complementary eval bar (in addition to the normal one) in live transmissions of events where an endgame is often 0.0 until it at some move mysteriously becomes  won by one side, but that 0.0 was almost impossible to find even many moves before.
Answers.UserDisplayName: Vladimir F Героям слава
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T14:59:30.650Z
Answers.Text: For (b), imagine a platform that displays chess matches and allows spectators to bet on the match. The platform must automatically determine the odds. If a spectator bets before the match starts, the odds can be determined using the players' ELO ratings. But if a spectator bets once the match has already started, the odds should be computed by taking into account the ELO ratings, the position on the board, and the times on the clock.
Answers.UserDisplayName: Stef
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-16T13:06:46.907Z
Answers.Text: The other use case for (b) would be to find moves with good practical chances of turning a losing game around. If you're at the point where the best move is just the one that prolongs loss the longest, then a move that loses quicker but gives more opportunity for the opponent to make a critical mistake is the better option. A simple metric would be to look for moves where the second best move is much worse than the best move. This would only apply to human vs human of course, as engines will never blunder like that.
Answers.UserDisplayName: eyeballfrog
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-16T15:52:33.483Z
Answers.Text: Time trouble is often a factor in computer-versus-computer matches.  If a computer which has more time per move, but is unlikely to win, has a choice between lines that involve simple positions where the opponent would have a slight advantage, or lines that involve much more complicated positions where the opponent would have a larger positional advantage, but having less time on the clock could be an offsetting disadvantage, exploiting the time difference would seem like it could realistically improve a computer's chances of winning or at least avoiding losing.
Answers.UserDisplayName: supercat
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-15T08:21:38.297Z
Answers.LastActivityDate: 2022-11-15T08:21:38.297Z
Answers.UserDisplayName: Hauke Reddmann
Answers.Body: <p>I imagine someone could go through a bunch of GM games that have time information included and do some sort of statistical analysis to correlate time with win probability for a given evaluation. It could never be perfect, but neither are traditional engine evaluations or ratings or anything else you'd use to predict the outcome of a game.</p>
  <p>But to make it reasonably accurate you'd also have to account for things like player strengths and material left on the board and known-drawn positions (a 0.0 evaluation coming out of a nonstandard opening and a 0.0 evaluation in an opposite-colored-bishops endgame with one pawn on each side are very different when it comes to win probability.) You'd probably want to check whether there's one narrow path to victory or multiple moves which could all do the job. You might also have to account for things like whether it's OTB or online; 10 seconds left to convert a won position when you have to physically hit a clock is way different from when you can use a mouse and can premove.</p>
  <p>It's mostly a question of whether someone is willing to put forth the effort to do all of this. Exactly how badly do we want to know the odds of one imperfect human beating another in a given situation?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T11:15:11.780Z
Answers.Text: I'd suggestthat it could make a useful study tool. If I'm in a won position with 5 seconds left, it may be that stockfish finds a really nice mate in 4 that is hard to find, but I would pre-move the very simple and obvious mate in 18 ladder. I'd argue that I made the correct choice, but if I had 1 minute left I'd spend 30 seconds finding the mate in 4
Answers.UserDisplayName: Darren H
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T17:19:33.683Z
Answers.Text: This is the type of discussion I was looking for :)
Answers.UserDisplayName: ihavenoidea
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T17:25:16.720Z
Answers.Text: This is what I was thinking about when I wrote this question. In earlier versions of Alphazero where the learning was supervised (learning from a dataset),  since the clock is generally an information we have stored, I thought that feeding the network with the clock information would then inherently have what I had in mind in my original question  (take time into consideration). However, since mostly all strong engines today use a selfplay approach for learning, I'm afraid it is impossible to use clock time since engines play moves infinitely faster than humans (continued)
Answers.UserDisplayName: ihavenoidea
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T17:26:03.573Z
Answers.Text: ...since engines play moves infinitely faster than human, using them to evaluate positions played by humans wouldn't make sense.
Answers.UserDisplayName: ihavenoidea
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T23:29:51.457Z
Answers.Text: Yeah, selfplay doesn't seem like it would be useful if you're trying to determine "how will the humans play" rather than "what's the best move".
Answers.UserDisplayName: D M
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-14T02:57:38.793Z
Answers.LastActivityDate: 2022-11-14T02:57:38.793Z
Answers.UserDisplayName: D M
Body: <p>Firstly, I am not suggesting that there is anything wrong the way engines are implemented at the moment, by analyzing only the current position regardless of time left by the players. This is great and it gives us a nearly perfect estimation of the position.</p>
  <p>To the best of my knowledge, current engines do not take into account the time left by the players in a game when analyzing a position.</p>
  <p>When I am watching an online transmission of a chess championship match, when the players get low on time it is very common for commentators to state &quot;Ohh, I don't think &lt;player&gt; will find this move with only 10 seconds on the clock!&quot;, when there's only one move in the position that it is really hard to find (hence would require more thinking time that they do not have). Maybe I am on the minority here, but I think it would be interesting to have a separate evaluation by an engine that takes into account the time left.</p>
  <hr />
  <p>My questions are: Is there such an evaluation out there? Are there any downsides when taking into account time or something that makes this calculation impossible to do?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-14T14:07:35.567Z
Comments.Text: The question is unclear: How would time left on the clock influence the evaluation?
Comments.UserDisplayName: xehpuk
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-14T17:09:16.360Z
Comments.Text: I think it's pretty clear as per my example in the third paragraph. An engine that follows my suggestion would not give a big winning score if the player is low on time and the winning patern is hard to find. On the other hand, a "regular" engine would just show a score of +10 (for example) disregarding these conditions I talked about previously.
Comments.UserDisplayName: ihavenoidea
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-14T17:27:59.767Z
Comments.Text: One could calculate a probability for 1-0, ½-½ and 0-1. But the evaluation of the position would stay the same anyway because it's simply independent of the clock situation.
Comments.UserDisplayName: xehpuk
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-14T17:32:21.937Z
Comments.Text: In my question I'm playing a "what if" game, what if engines (or an on-off parameter of it) take clock into consideration. I know an evaluation of a chess position is independent of the time left. We have seen players screw up  a winning position when low on time so it is obvious time left plays a huge part in a game between humans. I was wondering about an engine that would consider that.
Comments.UserDisplayName: ihavenoidea
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-14T19:49:13.107Z
Comments.Text: @ihavenoidea Engines generally have no idea how hard a move is for a human to find. You could imagine some metric looking at the distribution of evaluation changes for all possible moves (naively if there's only one good move, you might guess it's harder to spot), but you can probably think of a lot of counterexamples to that pretty easily (obvious mates in 1 for example).
Comments.UserDisplayName: llama
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-14T20:56:25.750Z
Comments.Text: Is it fair to say that your goal is for an engine to accurately predict which player will win, rather than objectively evaluate the position on the board with perfect play? Because that's fine, but engines usually do the latter, or try to play optimally themselves, which is also different than predicting how humans play.
Comments.UserDisplayName: usul
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-17T01:57:07.237Z
Comments.Text: It would have to take into account the player's mood, skill, ability to find the best move, etc. This is just not reasonably possible with engines, they are simply not advanced enough.
Comments.UserDisplayName: LuckElixir
Tags: <engines><evaluation><time-management>
Title: Why don't chess engines take into account the time left by each player?
ThreadText: # Why don't chess engines take into account the time left by each player?
  
  (Asked by: username_0 on 2022-11-13)
  
  Firstly, I am not suggesting that there is anything wrong the way engines are implemented at the moment, by analyzing only the current position regardless of time left by the players. This is great and it gives us a nearly perfect estimation of the position.
  
  To the best of my knowledge, current engines do not take into account the time left by the players in a game when analyzing a position.
  
  When I am watching an online transmission of a chess championship match, when the players get low on time it is very common for commentators to state "Ohh, I don't think <player> will find this move with only 10 seconds on the clock!", when there's only one move in the position that it is really hard to find (hence would require more thinking time that they do not have). Maybe I am on the minority here, but I think it would be interesting to have a separate evaluation by an engine that takes into account the time left.
  
  ---
  
  My questions are: Is there such an evaluation out there? Are there any downsides when taking into account time or something that makes this calculation impossible to do?
  
  **Tags:** engines, evaluation, time-management
  
  > **Comments:**
  > **username_1**: The question is unclear: How would time left on the clock influence the evaluation?  
  > **username_0**: I think it's pretty clear as per my example in the third paragraph. An engine that follows my suggestion would not give a big winning score if the player is low on time and the winning patern is hard to find. On the other hand, a "regular" engine would just show a score of +10 (for example) disregarding these conditions I talked about previously.  
  > **username_1**: One could calculate a probability for 1-0, ½-½ and 0-1. But the evaluation of the position would stay the same anyway because it's simply independent of the clock situation.  
  > **username_0**: In my question I'm playing a "what if" game, what if engines (or an on-off parameter of it) take clock into consideration. I know an evaluation of a chess position is independent of the time left. We have seen players screw up  a winning position when low on time so it is obvious time left plays a huge part in a game between humans. I was wondering about an engine that would consider that.  
  > **username_2**: @username_0 Engines generally have no idea how hard a move is for a human to find. You could imagine some metric looking at the distribution of evaluation changes for all possible moves (naively if there's only one good move, you might guess it's harder to spot), but you can probably think of a lot of counterexamples to that pretty easily (obvious mates in 1 for example).  
  > **username_3**: Is it fair to say that your goal is for an engine to accurately predict which player will win, rather than objectively evaluate the position on the board with perfect play? Because that's fine, but engines usually do the latter, or try to play optimally themselves, which is also different than predicting how humans play.  
  > **username_4**: It would have to take into account the player's mood, skill, ability to find the best move, etc. This is just not reasonably possible with engines, they are simply not advanced enough.  
  
  ---
  
  ## 8 answers
  
  ### Answer by username_27 on 2022-11-14. Score: 5 | Accepted answer
  
  I imagine someone could go through a bunch of GM games that have time information included and do some sort of statistical analysis to correlate time with win probability for a given evaluation. It could never be perfect, but neither are traditional engine evaluations or ratings or anything else you'd use to predict the outcome of a game.
  
  But to make it reasonably accurate you'd also have to account for things like player strengths and material left on the board and known-drawn positions (a 0.0 evaluation coming out of a nonstandard opening and a 0.0 evaluation in an opposite-colored-bishops endgame with one pawn on each side are very different when it comes to win probability.) You'd probably want to check whether there's one narrow path to victory or multiple moves which could all do the job. You might also have to account for things like whether it's OTB or online; 10 seconds left to convert a won position when you have to physically hit a clock is way different from when you can use a mouse and can premove.
  
  It's mostly a question of whether someone is willing to put forth the effort to do all of this. Exactly how badly do we want to know the odds of one imperfect human beating another in a given situation?
  
  > **Comments:**
  > **username_28**: I'd suggestthat it could make a useful study tool. If I'm in a won position with 5 seconds left, it may be that stockfish finds a really nice mate in 4 that is hard to find, but I would pre-move the very simple and obvious mate in 18 ladder. I'd argue that I made the correct choice, but if I had 1 minute left I'd spend 30 seconds finding the mate in 4  
  > **username_0**: This is the type of discussion I was looking for :)  
  > **username_0**: This is what I was thinking about when I wrote this question. In earlier versions of Alphazero where the learning was supervised (learning from a dataset),  since the clock is generally an information we have stored, I thought that feeding the network with the clock information would then inherently have what I had in mind in my original question  (take time into consideration). However, since mostly all strong engines today use a selfplay approach for learning, I'm afraid it is impossible to use clock time since engines play moves infinitely faster than humans (continued)  
  > **username_0**: ...since engines play moves infinitely faster than human, using them to evaluate positions played by humans wouldn't make sense.  
  > **username_27**: Yeah, selfplay doesn't seem like it would be useful if you're trying to determine "how will the humans play" rather than "what's the best move".  
  
  ---
  
  ### Answer by username_5 on 2022-11-13. Score: 27
  
  > Why don't chess engines take into account the time left by each player?
  
  For the simple reason that there is no way of knowing how to do that.
  
  A few years ago a clubmate rated about 1800 playing in the British Universities blitz (3+2) championships reached a KNB v K endgame. He knew the endgame and so blitzed out the win. I have other clubmates rated 2100+ who don't know that endgame and would not be able to checkmate in such period of time. Give them 20 minutes on the clock and they still might not succeed. There have been cases of IMs failing to do this at regular time controls.
  
  In short it is an impossible task.
  
  > **Comments:**
  > **username_6**: "no way of knowing how to do that" Umm,  In games between engines, the evaluation tend to zero. But between engine and persons, I believe that the engine's best play is the move that demands more precision to support the position or gain an advantage. Its the style, "introduce complications". This style of game will be more effective when the person lacks enough time to think.  
  > **username_7**: @username_6 Engines aren't always good at dealing with complications, either.  
  
  ---
  
  ### Answer by username_8 on 2022-11-14. Score: 20
  
  Because engines find the best move by assuming best play, not by hoping their opponent makes an inferior move.
  
  If you constructed an engine whose sole purpose was to beat a specific person/engine, then "likelihood to play a given bad move" could make sense as an evaluation parameter. But otherwise it's a waste of time to calculate something that would ultimately lead to the engine playing weaker moves.
  
  > **Comments:**
  > **username_9**: One *might* conceivably come up with a metric how hard it is to find that best move in a given time. One simple way to do that is to let *the engine itself* compare e.g. a static evaluation vs. the result of a regular n-ply search, while taking into account the number of moves retaining most of the equity ("OK moves", including the correct one) vs. "wrong" moves. I think there is a consensus that positions that have only one correct move are hard, especially if that move isn't obvious (e.g. detected by a static eval). Finding it may take time or genius.  
  > **username_10**: +1 correct answer.  
  > **username_11**: This is not 100% percent true, actually there is something called "contempt factor" which allows a bias toward assumed weaker players.  See https://www.chessprogramming.org/Contempt_Factor  
  > **username_12**: @username_11: Contempt is more about whether the engine should avoid (early) draws in an even position, not about whether the opponent will see the only good move. No reasonable engine should accept a draw when the evaluation is +5 in its favor, regardless of the contempt factor (within reason... I imagine there's some way of misconfiguring an engine so that it will behave in such a way, but that's not a "reasonable engine" anymore).  
  > **username_13**: When I played competitively, we analyzed the games of my upcoming opponents, in order to find out which play styles they are good in and and in which ones are they more likely to make weaker moves. Tailoring gameplay for a specific opponent is not unheard of.  
  > **username_8**: @username_13: Yes, that's extremely common for humans, as is the scenario mentioned by OP. It's also common for humans, even GMs, to prefer suboptimal moves to make the position easier, or even losing moves to make the position more complicated (Mikhail Tal was famous for that). But the question was about how computers play.  
  > **username_14**: More concisely, "Hoping for a misplay due to opponents rushing" is not optimal play.  
  > **username_15**: @username_14: On the other hand, being able to observe and exploit misplays by the opponent is necessary for optimal play.  One thing that's interesting when looking at analysis of top-tier chess games, at least at moderately short time controls, is how often a player will make a move that leaves an opening for the opponent, but the opponent will fail to see it.  
  
  ---
  
  ### Answer by username_10 on 2022-11-14. Score: 3
  
  This is an exposition of username_8 - Danny username_8's answer, which is correct. Given the option between making 1) the objectively strongest move and 2) the one against which the best move is "really hard to find", would you really rather an engine make move #2?
  
  Let's say you make move #2. If opponent doesn't find it, congrats, you win. If opponent does - then what? Did you just throw away your winning chances? Did you just go from losing to lost? If the answer to either of the above is "yes", not only should an engine not make that move, a human should not make that move either!
  
  Example:
  
  ```
  [FEN "3r2k1/2pqnpp1/1p5p/p2P4/P2p1rP1/2P1N3/1PQ2PP1/3RR1K1 w - - 0 1"]
  
  1. g3 dxe3 2. gxf4 Qxg4+
  
  ```
  
  This position is from Nepomniatchi-Carlsen, World Chess Championship 2021. It is dead equal - 0.00 eval according to Stockfish. Stockfish's main line begins with 1. Rxd4 and leads to a draw. However, Nepo played 1. g3. Now when a piece comes under attack, the first inclination is to move it. Accordingly, the first move Carlsen is likely to look at is 1...Rf6. Look a bit further though, and Black will notice that 1...dxe3 wins (since 2. gxf4? Qxg4+ followed by a rook lift is a decisive attack).
  
  **Would you really rather an engine play 1. g3 instead of 1. Rxd4?** Phrased alternatively, would you rather get a sure draw, or a "maybe" win that is a guaranteed loss if opponent sees the key move? Think about it. Nobody - engine or human - should prefer the latter.
  
  That said: engines do have a measure of how complex the current position is. If the engine believes it is stronger than its opponent, then it will try to steer the game towards more complex positions. Inferior opposition is more likely to blunder in those positions. That's how engines exploit their opponents.
  
  > **Comments:**
  > **username_16**: It doesn't have to be about what the engine plays but what it communicates to us humans. Personally I would think it would be pretty cool if an engine could rate the best line not just in centipawns but also provide some rating how hard this is to find for a human. There could be a lot of educational use in that.  
  > **username_15**: If one is using a computer as a sparring partner, having it occasionally make sub-optimal moves may be a useful form of practice.  At rapid time controls, even games between top-tier players will often feature multiple mistakes which could have changed the result by a half point if exploited, but which weren't noticed until post-game analysis.  Thus, an ability to exploit mistakes may be an extremely valuable skill, but one which couldn't be practiced very well if one only took on "perfect" opponents.  
  > **username_17**: So "Don't set traps" and "Don't play 'hope chess'", then?  
  > **username_10**: @username_17 I think that's a nice way of putting it. If you make an objectively inferior move hoping that the opponent will not spot it because of their time situation, then it's hope chess and it's something chess trainers try to dissuade their students from. It doesn't mean you shouldn't set traps, but it does mean that you should assume your opponent will see the trap and avoid it, in which case your move is still good.  
  > **username_17**: If a move is good (even if it isn't the best option), I'd say that it doesn't count as setting a trap. If your opponent then plays a move which enables you to get a position akin to your springing a trap, then what you did wasn't a trap, but punishing your opponent's blunder.  
  > **username_18**: *"That said: engines do have a measure of how complex the current position is."* Do you have a reference for this?  
  > **username_10**: @username_18 check out Stockfish's code here: https://github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp#L1065 There is a variable called "complexity", which is supposed to measure the complexity of the position. The NNUE complexity is hard to interpret, but the classical one is relatively straightforward. I can go into more detail if you like.  
  
  ---
  
  ### Answer by username_19 on 2022-11-13. Score: 2
  
  Stockfish has 'wtime' and 'btime' options, that get it to calculate as if white and black only have such and such time left. However, in cases you're mentioning where human players only have a few seconds to find a move, even here Stockfish would most likely find the move under these wtime & btime constraints.
  
  
  ---
  
  ### Answer by username_20 on 2022-11-15. Score: 1
  
  Position evaluation by an engine is completely objective. Put any 2 players in a given position and the eval is the same. Once you add the clock into the equation the evaluation becomes different depending on who the player is. The objective evaluation becomes a subjective evaluation which no longer has any concrete meaning.
  
  
  ---
  
  ### Answer by username_21 on 2022-11-15. Score: 0
  
  because it adds another variable which exponentially increases the number of calculations needed, so it wouldn't be able to calculate to as much of a depth as without it.
  
  > **Comments:**
  > **username_22**: Chess moves are already an exponential variable and there are various ways to cut the number of calculations down. So, I believe a constant calculation of time variable would not change the overall complexity, while it might give some information. Can you elaborate on what you claimed? Why do you think it would be a significant increase? Please edit and explain your answer as it looks more like a comment than an answer currently.  
  > **username_21**: @username_22 except it's not a constant calculation, you would have to consider the time left in each position, for it to be worthwhile you would have to search to a deeper depth to check if the move might actually be bad and then consider that they don't have "enough time" (a variable which changes based on so many things and would be extremely hard to calculate) and then after all that you'd be making your move based on the lower depth. which just doesn't make sense, so given the extra calculation time, just spend it on searching to deeper depth and just make the more 'correct' move.  
  > **username_21**: maybe at most you could do it in the very late game as it's conceivable that given your opponent moving in the minimum time (usually 0.1 seconds?) there may be lines that are impossible to win from due to the time taken. Also at the late game with less pieces there's far less complexity so it's easier to incorporate.  
  
  ---
  
  ### Answer by username_23 on 2022-11-15. Score: 0
  
  Let me chime in too. The OP's question is really two in one, which were conflated a bit in the discussion.
  
  a) HOW can you implement it?
  
  b) WHY should you implement it?
  
  I see no reason why a) should be impossible. For example, the reknowned game-theory primer "Winning Ways..." gives a clear mathematical notion how "hot" a game is. You can come up with more metrics - the depth and with of the decision tree, how "easy" a winning move is etc. This will get very tricky and as always is probably easier done quick-and-dirty, but why not?
  
  But I see a problem with b). What is the "use case" of doing all the work? Computer vs Computer? Surely not. Computer vs Human? Aw cmon, they annihilate you anyway :-) This leaves: training. I'm just reading the "Complete Chess Swindler", many games have been blundered in time trouble and someone like me who plays lightning fast *will* use it against you! Surely it can't hurt if you train finding the best move under time strain. But even in this case, I think pre-chosen positions are much more effective in training than random played games.
  
  Thus my verdict is: Nice-to-have feature, but lousy ROI to make one doing the programming work.
  
  > **Comments:**
  > **username_24**: Perhaps b) as a complementary eval bar (in addition to the normal one) in live transmissions of events where an endgame is often 0.0 until it at some move mysteriously becomes  won by one side, but that 0.0 was almost impossible to find even many moves before.  
  > **username_25**: For (b), imagine a platform that displays chess matches and allows spectators to bet on the match. The platform must automatically determine the odds. If a spectator bets before the match starts, the odds can be determined using the players' ELO ratings. But if a spectator bets once the match has already started, the odds should be computed by taking into account the ELO ratings, the position on the board, and the times on the clock.  
  > **username_26**: The other use case for (b) would be to find moves with good practical chances of turning a losing game around. If you're at the point where the best move is just the one that prolongs loss the longest, then a move that loses quicker but gives more opportunity for the opponent to make a critical mistake is the better option. A simple metric would be to look for moves where the second best move is much worse than the best move. This would only apply to human vs human of course, as engines will never blunder like that.  
  > **username_15**: Time trouble is often a factor in computer-versus-computer matches.  If a computer which has more time per move, but is unlikely to win, has a choice between lines that involve simple positions where the opponent would have a slight advantage, or lines that involve much more complicated positions where the opponent would have a larger positional advantage, but having less time on the clock could be an offsetting disadvantage, exploiting the time difference would seem like it could realistically improve a computer's chances of winning or at least avoiding losing.  
  
  ---
  
  