An algorithm is a sequenced set of instructions. All dynamic computer programs are algorithms. If you’re cooking a meal, assembling some flat pack furniture, or setting a digital chess clock, you’re following an algorithm. It should be a clear and unambiguous description of how to produce a delicious plate of food or a cupboard for your chess books.

You always need a plan when you’re playing chess. In endings in particular, concrete plans are important. You’ll very often develop and follow an algorithm to achieve your aim.

All chess endings are, in effect, minichess games, as they use a subset of the pieces, and so are ideal learning tools. Perhaps the most important minichess game of all is King and Queen against King. It’s absolutely vital that every ‘big chess’ player can do this quickly and efficiently while avoiding stalemate. If you follow an algorithm it’s not so hard.

Here’s one possible algorithm, taken from Chess Endings for Heroes.

1. Place your queen one row away from the enemy king. Whenever he moves towards the side, again move your queen to the next row.
1. Place your king two rows away from the enemy king.
1. Force the king towards the edge of the board. Every time he moves towards the edge place your queen on the next row.
1. When the black king reaches the edge move your king towards him, keeping two rows away, until you can get checkmate. Remember to put your queen in place first to avoid stalemate.

Many children prefer an alternative algorithm, which is also explained in Chess Endings for Heroes.

Place your queen a knight’s move away from the black king. Then keep on doing the same thing until he is stuck on the side of the board. Just make sure you don’t stalemate him in the corner. Then approach with your king until you’re close enough to get checkmate. (You might well think this is not sufficiently clear.)

There are several ways to run competitions using the king and queen checkmate. Here’s one idea. Start with a white king and queen, and a black king. Black chooses the starting position of the pieces (with the black king not in check). White wins by checkmating the black king within 15 moves (you only count the white moves). You might also want to play that illegal moves lose, so White can capture the black king if it moves into check. Black wins by surviving 15 moves, by getting stalemated, or by capturing the white queen.

Alternatively, take it in turns to play White. Count the moves: the winner is the player who gets checkmate more quickly.

Get children to write their own algorithms, for example to plan checkmate with two rooks. Or, for a harder task, to plan checkmate with king and rook against king. These tasks involve both language and mathematical skills so are great for schools.