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 ?
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:


Filter out a move if it's a gross blunder. It does that by comparing its score with another multi-pv score.
Generate a small random number and applied it to a multi-pv score
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



Engine considers BxQ



The best score is 0.00. Since this is the first move, there is nothing to do.



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.



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.