Stockfish has a very well documented codebase. Someone can learn a lot about chess even by just looking at the comments. As an example, here is what stockfish does in certain end games from the perspective of the strong side. For the weak side, the opposing plan is true. As a note for the rules that follow, they may not characterize all possible positions. If not, then the position has to be evaluated by looking more closely to its specifics.
Plenty of material vs King
– Just push the lone king towards the side and keep the distance of the two kings short.
King + Knight + Bishop vs King
– Similar as above. The difference is that the right corner is the corner with the same color as the bishop.
King + Pawn vs King
– It is evaluated based on some magic tables.
King + Rook vs King + Pawn
– If stronger’s side’s King is in front of the pawn, then this is a win.
– Similarly, if the weaker’s side’s King is too far from the pawn, it is also a win for the strong side.
– The position is a draw if the pawn is advanced and protected by the opposing king.
King + Rook vs King + Bishop
King + Rook vs King + Knight
– Draw, unless King and Kight are too far away.
King + Queen vs King + Pawn
– This is usually a win for the side with the Queen.
– The exception is when the Pawn is on the 7th rank, protected by the King, on the Rook or Bishop files, and the strong’s side King is far away from the pawn.
King + Queen vs King + Rook
– This is a win for the stronger side.
– The strong side wants the two kings closer and the enemy King driven to the edges.
King + 2 Knights vs King
King + Bishop + Pawns vs King
– This is in general a win for the strong side.
– Exception is when the pawns are in the same Rook file, where the promoting square is of different color compared to the Bishop and the enemy King can arrive there in time.
King + Bishop + Pawns vs King + Pawn
– Similar as above.
– Exception is when the pawns of the strong side are on a Knight’s file, there is an enemy’s pawn on the 7th rank and the bishop cannot attack it or if there is only one pawn from the strong side in that file. Then, there is a draw as long as the weak’s side King is within two squares from the blocking pawn, on the back two ranks, and the strong side’s King is farther away.
King + Queen vs King + Rook + Pawns
The weak is the one with King + Rook + Pawns.
– It returns a draw if the pawns form a “fortress” on the third rank and they defend the rook, and the king is at most up to rank 2, and the enemy king is farther away (rank 4 or beyond).
King + Rook + Pawn vs King + Rook
– Draw if the pawn is not too far advanced (5th rank), the defending king protects the queening square, and the attacking king is away. The draw is achieved through the third-rank defense.
– Draw if the pawn is on the 6th rank, by checking from behind the enemy King.
– Draw if the pawn is on the 6th rank or higher, the defending King controls the queening square, the defending rook is on the first rank and either the tempo is on the defending’s side or the distance between the two kings is at least two squares.
– Draw if the pawn is on A7, attacking Rook on A8, defending Rook behind the pawn, and defending King on H7 or G7. Symmetrically for a pawn on H7.
– Draw if the defending king is blocking the pawn and the attacking king is too far away.
– Win if the attacking king is closer to the pawn compared to the defending king. The pawn should not be on a rook’s file, though, and it should be close to be promoted.
King + Rook + Pawn vs King + Bishop
The only rule here concerns a possible pawn on a Rook file, which under some conditions can be a draw.
King + Rook + 2 Pawns vs King + Rook + 1 Pawn
Draw if the stronger side has no passed pawns and the defending king is actively placed.
King + Pawns vs King
Draw only if the pawns are on a Rook’s file and the defending king is in front of them.
King + Bishop + Pawn vs King + Bishop
– Draw if the defending King is in front of the Pawn and he can’t be kicked out.
– Draw if bishops are of opposite color and one of the following is true: (a) pawn is on rank 5 or earlier (b) the defending king is in front of the pawn or (c) the defending bishop attacks one square in front of the pawn and it is at least three squares farther away from the pawn.
King + Bishop + 2 Pawns vs King + Bishop
To have a forced draw, we need opposite color bishops. Then:
– Draw if the pawns are on the same file and the defending king is in front of the pawns.
– Draw if the pawns are on adjacents files, the defending king is in front of them, and the defending bishop controls the squares in front of them.
King + Bishop + Pawn vs King + Knight
– Draw easily if the defending King is in front of the Pawn, in a square that the attacking Bishop cannot go.
King + Knight + Pawn vs King
– Draw if a Rook pawn is on the 7th rank and the defending King is blocking it.
King + Knight + Pawn vs King + Bishop
– Win only if the Knight can prevent the Bishop from taking the Pawn.
King + Pawn vs King + Pawn
– Draw chances if the weaker side could achieve a draw even without its pawn.
– Exception is when the strong’s side Pawn is too advanced and the pawn is not on the Rook’s rank. Then, if the weaker side could have drawn even without its pawn, then it could have winning chances with its pawn.