Answers.Body: <p>In strength reduction mode, Stockfish starts a multi-pv where the engine searches for more than one best move. When the engine needs to make a move, it looks for all the possibilities in the multi-pv moves and choose a move with the following algorithm:</p>
  
  <ol>
  <li>Filter out a move if it's a gross blunder. It does that by comparing its score with another multi-pv score.</li>
  <li>Generate a small random number and applied it to a multi-pv score</li>
  <li>Pick the move if the transformed score is the best</li>
  </ol>
  
  <p>It might sound complicated but it isn't, let's do an example.</p>
  
  <p>Say, I exchanged my queen with yours. You could take my queen with your bishop or pawn. If you did it with your bishop, the position would have been equal. If you did with your pawn, your pawn position would have been ruined and lead to a slightly inferior position. If you did anything else, I would be a queen ahead.</p>
  
  <p>A possible scoring would be:</p>
  
  <ul>
  <li>BxQ -> 0.00</li>
  <li>PxQ -> -0.34</li>
  <li>Kh8 -> -9.99</li>
  </ul>
  
  <p>Not taking back the queen is a gross blunder and should be avoided whenever possible. When applied to the algorithm:</p>
  
  <p><strong>Calculation</strong></p>
  
  <ul>
  <li><ol>
  <li>Engine considers BxQ</li>
  </ol></li>
  </ul>
  
  <p>The best score is 0.00. Since this is the first move, there is nothing to do.</p>
  
  <ul>
  <li><ol start="2">
  <li>Engine considers PxQ</li>
  </ol></li>
  </ul>
  
  <p>Notice that without giving the move PxQ a small random boost, it'd never would be chosen because the best score (0.00) is greater than the score for PxQ (-0.34).</p>
  
  <p>Stockfish generates a small positive number and add it to PxQ. Now, there're two possibilities. If the random number is too small, say, 0.10, the added score (-0.34 + 0.10 = -0.24) is still too small compared to the best score (0.00), and it'd been discarded. If the generated random number is sufficient to push the PxQ score above the best score, for instance, 0.40. The new score for PxQ would have been 0.06 and it's greater than 0.00. Therefore, Stockfish would pick the PxQ.</p>
  
  <ul>
  <li><ol start="3">
  <li>Engine considers Kh8</li>
  </ol></li>
  </ul>
  
  <p>Not taking back the queen is a gross blunder. The difference between it with the previous move is too big (-9.99 - -0.34). Stockfish wouldn't consider it, and discard it immediately.</p>
  
  <p><strong>Implication</strong></p>
  
  <ul>
  <li>The engine will not play random chess</li>
  <li>The possibility of making an inferior move depends on the random generator. The generator usefulness also depends on the strength level. The weaker you ask Stockfish be, the more likely the generator will generate a bigger number.</li>
  <li>Stupid blunders are avoided</li>
  <li>The move Stockfish plays is unpredictable, simulating human's unpredictable behavior.</li>
  <li>Stockfish doesn't mimic Elo rating. It only gives you 20 strength levels.</li>
  </ul>
  
  <p><strong>Edited</strong></p>
  
  <p>The poster was concern about a link to the Stockfish for iOS in the comments. Please note that the statement in the link <em>"Set the strength of the engine on a 0 to 2500 scale. This scale roughly corresponds with the human ELO scale. 0 is absolutely terrible play, while 2500 is maximum strength."</em> is misleading and simply wrong. To see why, the page wasn't written by a Stockfish engine developer. The writer misinterpreted the scaling reported in the app. In reality, if you give the app, say Elo 2000, the app maps it to one of the 20 strength levels. Whatever Elo rating that you see in the app means absolutely nothing, it's just an easy way for an end-user to adjust the levels. There is no direct relationship between a strength level to a Elo rating. Think like this, if I modify the source code and expand the range from 0,20 to 0,40. Now when you choose strength 30, what's the rating? I could tell you it's Elo 2400, or Elo 2500, or Elo 3500.</p>
  
  <p>At the end of the day, Stockfish doesn't mimic Elo strength. The Elo labels that you see in the app are simply just beautiful labels that pretend there is a relationship.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T07:08:48.497Z
Answers.Text: Thanks. If you look here http://support.stockfishchess.org/kb/ios-app/stockfish-for-ios-overview it says that "Set the strength of the engine on a 0 to 2500 scale. This scale roughly corresponds with the human ELO scale. 0 is absolutely terrible play, while 2500 is maximum strength"
Answers.UserDisplayName: Dom
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T09:44:50.613Z
Answers.Text: See my edited answer.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T09:46:59.243Z
Answers.Text: Simple answer: what you saw in the link wasn't correct.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T09:49:05.337Z
Answers.Text: Furthermore, do you really believe Stockfish only performs up to Elo 2500? It's a much stronger engine than that.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T10:47:18.033Z
Answers.Text: I have no beliefs about Stockfish. I am simply reporting what is written in their support site (links from the main stockfish site).
Answers.UserDisplayName: Dom
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-29T16:43:19.340Z
Answers.Text: @Dominic Stockfish at its maximum plays stronger than 2500. It is the second strongest chess engine in the world.
Answers.UserDisplayName: Kanan Farzali
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-02T00:04:42.510Z
Answers.Text: @Dominic "Don't believe everything you read on the Internet". _Abraham Lincoln_.
  Also, Stockfish 7's rating (64-bit Quad Processor, etc.) is about 3300 ELO at max settings.  I think the documentation guys are pulling a few punches.
Answers.UserDisplayName: jaxter
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-16T18:20:05.983Z
Answers.Text: awesome, nice post.
  Do you know how many moves it adds these random numbers to?  If its only using, say, the top 3 best moves, however big the random number is, the move it chooses is still going to be pretty good.  (Whats the multi-pv?)
Answers.UserDisplayName: john k
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-23T23:52:57.157Z
Answers.LastActivityDate: 2017-01-18T02:32:54.800Z
Answers.LastEditDate: 2017-01-18T02:32:54.800Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>If you want a "friendly" computer opponent, some of the available packages offer the ability to "spar", in which they will evaluate <em>your</em> moves, and generate a rating for you that way. Then, they will adjust their play to be (roughly) at your level.</p>
  
  <p>Fritz, for example, has a variety of such "hobbling" methods, including </p>
  
  <ul>
  <li>"<em>Friend</em>" mode (which behaves as I described),</li>
  <li>"<em>Sparring</em>" mode, in which the program occasionally makes tactical mistakes, with 3 levels of play, including an optional "alert" feature to encourage you to look for such a mistake</li>
  <li>"<em>Handicap and fun mode</em>", in which you adjust variables that affect play, such as playing strength (they say in ELO pts, but see above), piece biases, king safety, tendency to attack, etc.</li>
  </ul>
  
  <p>Note that my comments on Fritz are for version 9, and they're at 15 now, so it's probably a bit different.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-02T00:15:13.333Z
Answers.LastActivityDate: 2016-10-02T00:15:13.333Z
Answers.UserDisplayName: jaxter
Body: <p>I am a fairly new chess player (say 1400) and I would like to play against Stockfish and win some of the time. If I change the strength to 1400 then what does the algorithm actually do ? Does it make random blunders or does it simply reduce its depth and thereby only see the easiest tactical combinations of moves. If so, what would the depth be for a 1400 rating ?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-23T23:08:10.287Z
Comments.Text: If it does it at all, it will do it by purposefully (or randomly) choosing bad moves. None of the engines do this well. If you want to win some games, I recommend you attend your local chess club and play humans.
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-29T11:53:04.707Z
Comments.Text: Stockfish alternates between ultrastrong and ultraweak moves when set at low levels. I think Shredder or The Chess Crazy Bishop play at a more consistent level at lower Elo's. Low rated engines from CCRL might be more consistent too.
Comments.UserDisplayName: A passerby
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-27T18:42:21.650Z
Comments.Text: For Stockfish, see my Q&A https://chess.stackexchange.com/questions/35312/how-do-stockfish-levels-work
Comments.UserDisplayName: qwr
Tags: <engines><elo><stockfish>
Title: How does a chess engine mimic an Elo rating
ThreadText: # How does a chess engine mimic an Elo rating
  
  (Asked by: username_0 on 2014-10-23)
  
  I am a fairly new chess player (say 1400) and I would like to play against Stockfish and win some of the time. If I change the strength to 1400 then what does the algorithm actually do ? Does it make random blunders or does it simply reduce its depth and thereby only see the easiest tactical combinations of moves. If so, what would the depth be for a 1400 rating ?
  
  **Tags:** engines, elo, stockfish
  
  > **Comments:**
  > **username_1**: If it does it at all, it will do it by purposefully (or randomly) choosing bad moves. None of the engines do this well. If you want to win some games, I recommend you attend your local chess club and play humans.  
  > **username_2**: Stockfish alternates between ultrastrong and ultraweak moves when set at low levels. I think Shredder or The Chess Crazy Bishop play at a more consistent level at lower Elo's. Low rated engines from CCRL might be more consistent too.  
  > **username_3**: For Stockfish, see my Q&A https://chess.stackexchange.com/questions/35312/how-do-stockfish-levels-work  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2014-10-23. Score: 7
  
  In strength reduction mode, Stockfish starts a multi-pv where the engine searches for more than one best move. When the engine needs to make a move, it looks for all the possibilities in the multi-pv moves and choose a move with the following algorithm:
  
  1. Filter out a move if it's a gross blunder. It does that by comparing its score with another multi-pv score.
  2. Generate a small random number and applied it to a multi-pv score
  3. Pick the move if the transformed score is the best
  
  It might sound complicated but it isn't, let's do an example.
  
  Say, I exchanged my queen with yours. You could take my queen with your bishop or pawn. If you did it with your bishop, the position would have been equal. If you did with your pawn, your pawn position would have been ruined and lead to a slightly inferior position. If you did anything else, I would be a queen ahead.
  
  A possible scoring would be:
  
  * BxQ -> 0.00
  * PxQ -> -0.34
  * Kh8 -> -9.99
  
  Not taking back the queen is a gross blunder and should be avoided whenever possible. When applied to the algorithm:
  
  **Calculation**
  
  * 1. Engine considers BxQ
  
  The best score is 0.00. Since this is the first move, there is nothing to do.
  
  * 2. Engine considers PxQ
  
  Notice that without giving the move PxQ a small random boost, it'd never would be chosen because the best score (0.00) is greater than the score for PxQ (-0.34).
  
  Stockfish generates a small positive number and add it to PxQ. Now, there're two possibilities. If the random number is too small, say, 0.10, the added score (-0.34 + 0.10 = -0.24) is still too small compared to the best score (0.00), and it'd been discarded. If the generated random number is sufficient to push the PxQ score above the best score, for instance, 0.40. The new score for PxQ would have been 0.06 and it's greater than 0.00. Therefore, Stockfish would pick the PxQ.
  
  * 3. Engine considers Kh8
  
  Not taking back the queen is a gross blunder. The difference between it with the previous move is too big (-9.99 - -0.34). Stockfish wouldn't consider it, and discard it immediately.
  
  **Implication**
  
  * The engine will not play random chess
  * The possibility of making an inferior move depends on the random generator. The generator usefulness also depends on the strength level. The weaker you ask Stockfish be, the more likely the generator will generate a bigger number.
  * Stupid blunders are avoided
  * The move Stockfish plays is unpredictable, simulating human's unpredictable behavior.
  * Stockfish doesn't mimic Elo rating. It only gives you 20 strength levels.
  
  **Edited**
  
  The poster was concern about a link to the Stockfish for iOS in the comments. Please note that the statement in the link *"Set the strength of the engine on a 0 to 2500 scale. This scale roughly corresponds with the human ELO scale. 0 is absolutely terrible play, while 2500 is maximum strength."* is misleading and simply wrong. To see why, the page wasn't written by a Stockfish engine developer. The writer misinterpreted the scaling reported in the app. In reality, if you give the app, say Elo 2000, the app maps it to one of the 20 strength levels. Whatever Elo rating that you see in the app means absolutely nothing, it's just an easy way for an end-user to adjust the levels. There is no direct relationship between a strength level to a Elo rating. Think like this, if I modify the source code and expand the range from 0,20 to 0,40. Now when you choose strength 30, what's the rating? I could tell you it's Elo 2400, or Elo 2500, or Elo 3500.
  
  At the end of the day, Stockfish doesn't mimic Elo strength. The Elo labels that you see in the app are simply just beautiful labels that pretend there is a relationship.
  
  > **Comments:**
  > **username_0**: Thanks. If you look here http://support.stockfishchess.org/kb/ios-app/stockfish-for-ios-overview it says that "Set the strength of the engine on a 0 to 2500 scale. This scale roughly corresponds with the human ELO scale. 0 is absolutely terrible play, while 2500 is maximum strength"  
  > **username_4**: See my edited answer.  
  > **username_4**: Simple answer: what you saw in the link wasn't correct.  
  > **username_4**: Furthermore, do you really believe Stockfish only performs up to Elo 2500? It's a much stronger engine than that.  
  > **username_0**: I have no beliefs about Stockfish. I am simply reporting what is written in their support site (links from the main stockfish site).  
  > **username_5**: @Dominic Stockfish at its maximum plays stronger than 2500. It is the second strongest chess engine in the world.  
  > **username_6**: @Dominic "Don't believe everything you read on the Internet". _Abraham Lincoln_. Also, Stockfish 7's rating (64-bit Quad Processor, etc.) is about 3300 ELO at max settings.  I think the documentation guys are pulling a few punches.  
  > **username_7**: awesome, nice post. Do you know how many moves it adds these random numbers to?  If its only using, say, the top 3 best moves, however big the random number is, the move it chooses is still going to be pretty good.  (Whats the multi-pv?)  
  
  ---
  
  ### Answer by username_6 on 2016-10-02. Score: 0
  
  If you want a "friendly" computer opponent, some of the available packages offer the ability to "spar", in which they will evaluate *your* moves, and generate a rating for you that way. Then, they will adjust their play to be (roughly) at your level.
  
  Fritz, for example, has a variety of such "hobbling" methods, including
  
  * "*Friend*" mode (which behaves as I described),
  * "*Sparring*" mode, in which the program occasionally makes tactical mistakes, with 3 levels of play, including an optional "alert" feature to encourage you to look for such a mistake
  * "*Handicap and fun mode*", in which you adjust variables that affect play, such as playing strength (they say in ELO pts, but see above), piece biases, king safety, tendency to attack, etc.
  
  Note that my comments on Fritz are for version 9, and they're at 15 now, so it's probably a bit different.
  
  
  ---
  
  