This commit is contained in:
Miloslav Ciz 2022-09-09 18:37:16 +02:00
parent 22c5543823
commit f82f156102
6 changed files with 198 additions and 26 deletions

View file

@ -1,20 +1,21 @@
# Chess
Chess is an old two-player board [game](game.md), perhaps most famous and popular among all board games in history. It is a complete information game that simulates a battle of two armies on a 64x64 board with different battle pieces. Chess has a world-wide competitive community and is considered an intellectual sport but is also a topic of active research (chess is unlikely to be ever solved due to its non-trivial rules combined with enormous state space, Shannon estimated the number of possible games at 10^120) and programming (many chess engines, [AI](ai.md)s and frontends are being actively developed).
Chess is an old two-player board [game](game.md), perhaps most famous and popular among all board games in history. It is a [complete information](complete_information.md) game that simulates a battle of two armies on a 64x64 board with different battle pieces. Chess has a world-wide competitive community and is considered an intellectual sport but is also a topic of active research (chess is unlikely to be ever solved due to its non-trivial rules combined with enormous state space, Shannon estimated the number of possible games at 10^120) and programming (many chess engines, [AI](ai.md)s and frontends are being actively developed).
{ There is a nice black and white indie movie called *Computer Chess* about chess programmers of the 1980s, it's pretty good, very oldschool, starring real programmers and chess players, check it out. ~drummyfish }
[Drummyfish](drummyfish.md) has created a suckless/[LRS](lrs.md) chess library [smallchesslib](smallchesslib.md) which includes a simple engine called *smolchess*.
**At [LRS](lrs.md) we consider chess to be one of the best games**, if not the very best one, for the following reasons:
**At [LRS](lrs.md) we consider chess to be one of the best games** for the following reasons:
- It is just a greatly interesting and deep game in which luck plays minimal role.
- **It is [suckless](suckless.md)**, the rules are very simple, it can be implemented on simple 8bit computers. The game doesn't even require a computer to play and chess masters don't even need a physical board to play (they can completely visualize it in memory). In the end one can in theory just play against himself in his head, achieving ultimate freedom: the only dependency of the game is one's brain, i.e. it becomes a [brain software](brain_software.md). Chess is extremely inexpensive, doesn't discriminate against poor people and will survive even the most extreme technological [collapse](collapse.md).
- **It is greatly [suckless](suckless.md)**, the rules are very simple, it can be implemented on simple 8bit computers. Of course the game doesn't even require a computer, just a board and a few pieces -- chess masters don't even need a board to play (they can completely visualize the games in memory). In the end one can in theory just play against himself in his head, achieving the ultimate freedom: the only dependency of the game is one's brain, i.e. it becomes a [brain software](brain_software.md). Chess is extremely inexpensive, doesn't discriminate against poor people and will survive even the most extreme technological [collapse](collapse.md).
- **No one owns chess**, the game is hundreds of years old and many books about it are also already in the [public domain](public_domain.md). It is extremely free.
- It is a basis for other derived games, for example many different chess variants or chess puzzles which can be considered a "singleplayer chess game".
- It is a source of many interesting [mathematical](math.md) and programming challenges.
- It seems to strike the right balance of simplicity and complexity, it is very simple but not so trivial as to be ever solved in a foreseeable future.
## Chess in General
## Chess In General
Chess evolved from ancient board games in India in about 6th century. Nowadays the game is internationally governed by **FIDE** which has taken the on role of an authority that defines the official rules: FIDE rules are considered to be the standard chess rules. FIDE also organizes tournaments, promotes the game and keeps a list of registered players whose performance it rates with so called Elo system based on the performance it also grants titles such as **Grandmaster** (GM, strongest), **Internation Master** (IM, second strongest) or **Candidate Master** (CM).
@ -28,7 +29,7 @@ Currently the best player in the world is pretty clearly Magnus Carlsen from Nor
During [covid](covid.md) chess has experienced a small boom among normies and [YouTube](youtube.md) chess channels have gained considerable popularity. This gave rise to [memes](meme.md) such as the bong cloud opening popularized by a top player and streamer Hikaru Nakamura; the bong cloud is an intentionally shitty opening that's supposed to taunt the opponent (it's been even played in serious tournaments lol).
## Chess and Computers
## Chess And Computers
{[This](https://www.youtube.com/watch?v=DpXy041BIlA) is an absolutely amazing video about weird chess algorithms :) ~drummyfish}
@ -82,7 +83,50 @@ Many other aspects come into the AI design such as opening books (databases of b
## Rules
TODO
The exact rules of chess and their scope may depend on situation, this is just a sum up of rules generally used nowadays.
The start setup of a chessboard is following (lowercase letters are for black pieces, uppercase for white pieces, on a board with colored squares A1 is black):
```
_______________
/8 |r n b q k b n r|
r | 7 |p p p p p p p p|
a | 6 |. . . . . . . .|
n | 5 |. . . . . . . .|
k | 4 |. . . . . . . .|
s | 3 |. . . . . . . .|
| 2 |P P P P P P P P|
\1 |R N B Q K B N R|
"""""""""""""""
A B C D E F G H
\_____________/
files
```
Players take turns in making moves, white always starts. A move consists of moving one (or in special cases two) of own pieces from one square to another, possibly capturing (removing from the board) one opponent's piece -- except for a special en passant move capturing always happens by moving one piece to the square occupied by the opposite color piece (which gets removed). Of course no piece can move to a square occupied by another piece of the same color. A move can NOT be skipped. A player wins by giving a **checkmate** to the opponent (making his king unable to escape attack) or if the opponent resigns. If a player is to move but has no valid moves, the game is a draw, so called **stalemate**. If neither player has enough pieces to give a checkmate, the game is a draw, so called **dead position**. There are additional situation in which game can be drawn (threefold repetition of position, 50 move rule). Players can also agree to a draw. A player may also be declared a loser if he cheated, if he lost on time in a game with clock etc.
The individual pieces and their movement rules are:
- **pawn** (`P`): Moves 1 square forward (white towards 8th rank, black towards 1st rank), unless that square is occupied by any piece (even enemy piece, pawns cannot capture going forward). From its start position a pawn can optionally move 2 squares if neither of the 2 forward squares are occupied. Pawn can capture enemy pieces 1 square diagonally forward (i.e. 1 square forward right or 1 square forward left).
- **rook** (`R`): Moves any number of squares either horizontally or vertically, but cannot jump over any pieces, however can capture (i.e. land) on a square occupied by enemy piece and capture it.
- **knight** (`N`): Can jump over pieces (both friendly and enemy), moves in "L" shapes, i.e. from its square a knight can jump to (with a possible capture) a square 2 squares in one direction and 1 square in the perpendicular direction (e.g. 2 squares down and 1 square right, or 2 squares right and 1 square up etc.).
- **bishop** (`B`): Moves like rook but diagonally, i.e. a bishop will only ever be able to move on squares of one color (the one it starts on).
- **queen** (`Q`): Can move both like bishop and rook.
- **king** (`K`): Can move (and capture) to any of the 8 immediately neighboring squares.
**Check**: If the player's king is attacked, i.e. it is immediately possible for an enemy piece to capture the king, the player is said to be in check. A player in check has to make such a move as to not be in check after that move.
A player cannot make a move that would leave him in check!
**Castling**: If a player hasn't castled yet and his king hasn't been moved yet and his kingside (queenside) rook hasn't been moved yet and there are no pieced between the king and the kingside (queenside) and the king isn't and wouldn't be in check on his square or any square he will pass through or land on during castling, short (long) castling can be performed. In short (long) castling the king moves two squares towards the kingside (queenside) rook and the rook jumps over the king to the square immediately on the other side of the king.
**Promotion**: If a pawn reaches the 1st or 8th rank, it is promoted, i.e. it has to be switched for either queen, rook, bishop or knight of the same color.
**Checkmate**: If a player is in check but cannot make any move to get out of it, he is checkmated and lost.
**En passant**: If a pawn moves 2 squares forward (from the start position), in the immediate next move the opponent can take it with a pawn in the same way as if it only moved 1 square forward (the only case in which a piece captures a piece by landing on an empty square).
Threefold repetition is a rule allowing a player to claim a draw if the same position (piece positions, player's turn, castling rights, en passant state) occurs three times (not necessarily consecutively). The 50 move rule allows a player to claim a draw if no pawn has moved and no piece has been captured in last 50 moves (both players making their move counts as a single move here).
## See Also