# How does a chess engine mimic an Elo rating

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 ?

• 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. Oct 23 '14 at 23:08
• 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. Sep 29 '15 at 11:53

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.

1. 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.

1. 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.

• Thanks. If you look here support.stockfishchess.org/kb/ios-app/… 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"
– Dom
Oct 24 '14 at 7:08
• See my edited answer. Oct 24 '14 at 9:44
• Simple answer: what you saw in the link wasn't correct. Oct 24 '14 at 9:46
• Furthermore, do you really believe Stockfish only performs up to Elo 2500? It's a much stronger engine than that. Oct 24 '14 at 9:49
• I have no beliefs about Stockfish. I am simply reporting what is written in their support site (links from the main stockfish site).
– Dom
Oct 24 '14 at 10:47

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.