User:NameDue/sandbox

A chess puzzle is a puzzle in which knowledge of the pieces and rules of chess is used to solve logically a chess-related problem. The history of chess puzzles reaches back to the Middle Ages and has evolved since then.

Usually the goal is to find the single best, ideally aesthetic move or a series of single best moves in a chess position, which was created by a composer or is from a real game. But puzzles can also set different objectives. Examples include deducing the last move played, the location of a missing piece, or whether a player has lost the right to castle. Sometimes the objective is antithetical to normal chess, such as helping (or even compelling) the opponent to checkmate one's own king. One of the most notable studies of today is one Leopold Mitrofanov's 1967 first prize winner, which about Tim Krabbé (who made a puzzle featuring a rook castling vertically, before this move was specifically disallowed) said "[i]t would be my candidate for 'study of the millennium'". Unfortunately, Mitrofanov's original study was subsequently found to have a cook, a miraculous defense that enabled Black either to obtain perpetual check or reach a drawn ending.

Chess problems
Whereas the term chess puzzle refers broadly to any puzzle involving aspects of chess, a chess problem is an orthodox puzzle (see below) in which one must play and win or draw a game, starting with a certain composition of pieces on the chess board, and playing within the standard rules of chess.

Orthodox chess problems involve positions that can arise from actual game play (although the process of getting to that position may be unrealistic). The most common orthodox chess puzzle takes the form of checkmate in n moves. The puzzle positions are seldom similar to positions from actual play, and the challenge is not to find a winning move, but rather to find the (usually unique) move which forces checkmate as rapidly as possible.

Heterodox chess problems involve conditions that are impossible with normal play, such as multiple kings or chess variants, while fairy chess problems employ pieces not used in orthodox chess, such as the amazon (a piece combining the powers of the queen and the knight).

Tactical puzzles
Chess puzzles can also be regular positions from a game (with normal rules), usually meant as training positions, tactical or positional, from all phases of the game (openings, middlegame of endings). These are known as tactical puzzles. They can range from a simple "Mate in one" combination to a complex attack on the opponent's king. Solving tactical chess puzzles is a very common chess teaching technique. Although it is unlikely that the same position will occur in a game the student plays, the recognition of certain patterns can help to find a good move or plan in another position. Here is one example where by standard valuations Black is materially stronger by 20-points, yet White having the tempo, can force a win. (Note that underpromoting Black's f-pawn to a knight is key to reaching the initial position due to the pawn structure, which for to legally occur with the structure of all the other pieces, can not do so through pawn captures alone.)

The solution is:
 * 1.gxh7+ 	: Only now can White's c-pawn capture Black's queen, Kxh7 2.cxb6
 * 2...Bf7+	: Prevents g6+, 3.Kh4
 * 3...Be7       : Prevents d8Q, 4.b7
 * 4...Rb3	: Prevents b8Q.
 * 5.Bb6 		: Protect White's b-pawn from Black's rook, 5...Rb4+
 * 6.Kg3 		: If Kh3, then White can not force a win, Ne4+ 7.Kh2 Nxd2 8.Nxd2 Rh4+ 9.Kg3 Rh5 10.g6+ Bxg6
 * 11.d8=Q 	: If b8=Q, then White can not force a win.
 * 11...Rg5+ 	: If Bxd8 now, then Black will lose faster, 12.Kf2 Rf5+ 13.Ke1 Bxd8 14.Bxd8 Nxe3 15.b8=Q Nc2+ 16.Kd1 a3 17.Kb3
 * 17...e4	: Protects pawn on d3 from queen on b3, will also be sacrificed to deflect knight on d2 from preventing Rf1+ followed by Bxe4, 18.Nxe4 Rf1+ 19.Kd2 Bxe4
 * 20.Bb6 	: Preparing for Qf4+, Re1 21.Qf7+ Kxh6 22.Bc7 Re2+ 23.Kc3 Kg5 24.Qf4+ Kg6 25.Qg4+ Kf7 26.Qd7+ Kg6 27.Bf4 Kf6 28.Qd6+ Kf7 29.Qc7+ Kf6
 * 30.Qd8+ 	: Variation is Qe5+ which can force a win by virtue of the Queen vs Rook endgame, Kf7 31.Bg5 a2 32.Qf6+ Kg8 33.Qe6+ Kg7 34.Qxa2 Nd4 35.Qa4 Nf3 36.Qd7+ Kg6 37.Bf4 Rc2+ 38.Kb3 Rc6 39.Kb4 Kf6 40. Be3 Rc4+ 41.Kb3 Rc6 42.Qd8+ Kf5 43.Qf8+ Rf6 44.Qc8+ Re6 45.Qd7 Ke5 46.Qc7+ Kf6 47.a6 d2 48.Qd8+ Kf7 49.Bxd2 Rxa6
 * 50.Qd7+ 	: Preparing for Qxa6, Kg6 51.Qe8+ Kf5 52.Qb5+ Kg4
 * 53.Qxa6 	: After Nxd2+, White can prevent black from reaching the Karstedt fortress position, and force a win by virtue of the Queen vs Bishop and Knight endgame, Nxd2+

Puzzles and special moves
The special moves or rules of chess, such as castling, underpromotion, double-square pawn advance, and en passant are commonly a key feature of puzzles, as are sacrifices.

Castling
Castling in the endgame occurs seldom and more often seen in puzzles. Here is one example where White wins by privilege of castling rights.

Try: 1.0-0-0? Ra2! 2.d7 Ra1+ 3.Kc2 Rxd1 4.Kxd1 Kc7 drawn. White needs 1.d7! Kc7 2.d8Q! Kxd8 3.0-0-0+ simultaneously attacking the king and rook that is captured next move.

Underpromotion
As with castling, undrepromotion in the endgame occurs seldom and more often seen in puzzles. Here is one example where White wins by multiple use of the privilege of underpromotion rights. The solution is 1.a8N d3 2.Nc6 cxb6 3. c7 b6 4.c8N b4 5.Nd6 exd6 6.e7 d5 7.e8N d4 8.Nf6 gxf6 9.g7 f5 10.g8N#, there are no winning variations.

{| align="right"
 * -valign="top"

Double-square pawn advance
As with castling and undrepromotion, the double-square pawn advance in the endgame occurs seldom and more often seen in puzzles. Here is one example where White wins by multiple use of the privilege of double-square pawn advance rights. The solution is 1.f4 Qa1 2.gxf6 Rxf6+ 3.Qxf6 Bxf6 4.Kxf6 Qf1 5.f5 Qh1 6.Bd5 Qxd5 7.Rd7 Qg8 .Bxd4 Qf8+ 9.Ke6+ Kg8 10.Nc6 Qe8+ 11.Ne7+ Kf8 12.Bxe3 Qf7+ 13.Ke5 Qe8 14.Kd6 g2 15.Bc5 Qxh5 16.Nd5 g1Q 17.Bxg1 Qxf5 18.Bc5 Qf7 19.Ke5+ Kg7 20.Rfx7 Kxf7 21.Nf6 h5 22.Nxh5 Ke8 23.d4 Kd8 24.d5 h6 25.d6 Kc8 26.Nf6 h5 27.d7+ Kc7 28.Ke6 h4 29.Nd5+ Kc6 30.d8Q Kxc5 31.Qb6+ Kc4 32.Ne3#. The single-square pawn advance to f3 draws due to the reply of Re8+, and all other moves loses.

En passant
As with castling, undrepromotion, and the double-square pawn advance, en passant in the endgame occurs seldom and more often seen in puzzles. Here is one example where White wins by the privilege of en passant rights. The position is after Black's double-square pawn advance to h5 from h7. All variations of the solution begin with the gxh6 en passant.

{| align="left"
 * -valign="bottom"

Solitaire Chess
Solitaire Chess is a chess puzzle produced by ThinkFun. The puzzle is played on 4x4 board. The starting position contains several chess pieces. The solver may play capturing moves only. The goal is to achieve a final position that contains only a single piece (similar to peg solitaire). There are no pawn promotions and the king can be captured as other pieces.

An example of Solitaire Chess puzzle is shown at the right. The solution is: 1.Nxb2, 2.Rxb2, 3.Rxb3.

Chess miner
Chess miner is a chess puzzle, where the goal is to deduce the location of invisible pieces based on information about how many times certain squares are attacked. For example, in the position at right, the challenge is to place a white king, queen, rook, knight, and bishop in the five marked squares so that the squares with numbers in them are attacked zero and four times respectively. The solution is to place the queen at a1 (the only place where it doesn't attack a6), king at d6 (the only place where it attacks c6), rook at c8, bishop at a4 and knight at a7.

OUTCOMMENTED -->

Mathematical chess problems

 * Main article: Mathematical chess problem

Some chess problems, like the Eight queens puzzle or the Knight's Tour, have connections to mathematics, especially to graph theory and combinatorics. Many famous mathematicians have studied such problems, including Euler, Legendre, and Gauss. Besides finding a solution to a particular puzzle, mathematicians are usually interested in counting the total number of possible solutions, finding solutions with certain properties, and generalization of the problems to n×n or rectangular boards.