This commit is contained in:
Miloslav Ciz 2023-10-21 23:33:47 +02:00
parent ae83a3d0c0
commit 1ab3672b68
7 changed files with 179 additions and 69 deletions

View file

@ -6,6 +6,7 @@ Here is a list of some acronyms:
- **[AA](aa.md)** (anti [aliasing](aliasing.md))
- **[AC](ac.md)** (alternating current, air conditioning)
- **[AD](ad.md)** (anno domini)
- **[ACID](acid.md)** (atomicity consistency isolation durability)
- **[ACK](ack.md)** (acknowledgement)
- **[ADSL](adsl.md)** (asymmetric digital subscriber line)
@ -30,8 +31,9 @@ Here is a list of some acronyms:
- **[B4](b4.md)** (before)
- **[BASH](bash.md)** (bourne again shell)
- **[BASIC](basic.md)** (beginner all purpose symbolic instruction code)
- **[BBC](bbc.md)** (big black cock)
- **[BBS](bbs.md)** (bulletin board system)
- **[BC](bc.md)** (bytecode)
- **[BC](bc.md)** (bytecode, before Christ)
- **[BCD](bcd.md)** (binary coded decimal)
- **[BDFL](bdfl.md)** (benevolent dictator for life)
- **[BDSM](bdsm.md)** (bondage domination sadism masochism)

View file

@ -4,7 +4,7 @@ In [mathematics](math.md) chaos is a phenomenon that makes it extremely difficul
Perhaps the most important point is that a chaotic system is difficult to predict NOT because of [randomness](randomness.md), lack of information about it or even its incomprehensible complexity (many chaotic systems are defined extremely simply), but because of its inherent structure that greatly amplifies any slight nudge to the system and gives any such nudge a great significance. This may be caused by things such as [feedback loops](feedback_loop.md) and [domino effects](domino_effect.md). Generally we describe this behavior as so called **[butterfly effect](butterfly_effect.md)** -- we liken this to the fact that a butterfly flapping its wings somewhere in a forest can trigger a sequence of events that may lead to causing a tornado in a distant city a few days later.
Examples of chaotic systems are the double pendulum, weather (which is why it is so difficult to predict it), dice roll, [rule 30](rule_30.md) cellular automaton, [logistic map](logistic_map.md), gravitational interaction of [N bodies](n_body.md) or [Lorenz differential equations](lorenz_system.md). [Langton's ant](langtons_ant.md) sometimes behaves chaotically. Another example may be e.g. a billiard table with multiple balls: if we hit one of the balls with enough strength, it'll shoot and bounce off of walls and other balls, setting them into motion and so on until all balls come to stop in a specific position. If we hit the ball with exactly the same strength but from an angle differing just by 1 degree, the final position would probably end up being completely different. Despite the system being deterministic (governed by exact and predictable laws of motion, neglecting things like quantum physics) a slight difference in input causes a great different in output.
Examples of chaotic systems are the double pendulum, logistic map, weather (which is why it is so difficult to predict it), dice roll, [rule 30](rule_30.md) cellular automaton, [logistic map](logistic_map.md), gravitational interaction of [N bodies](n_body.md) or [Lorenz differential equations](lorenz_system.md). [Langton's ant](langtons_ant.md) sometimes behaves chaotically. Another example may be e.g. a billiard table with multiple balls: if we hit one of the balls with enough strength, it'll shoot and bounce off of walls and other balls, setting them into motion and so on until all balls come to stop in a specific position. If we hit the ball with exactly the same strength but from an angle differing just by 1 degree, the final position would probably end up being completely different. Despite the system being deterministic (governed by exact and predictable laws of motion, neglecting things like quantum physics) a slight difference in input causes a great different in output.
A simple example of a chaotic equation is also the function *sin(1/x)* for *x* near 0 where it oscillates so quickly that just a tiny shift along the *x* axis drastically changes the result. See how unpredictable results a variant of the function can give:
@ -16,4 +16,94 @@ A simple example of a chaotic equation is also the function *sin(1/x)* for *x* n
| 4.004 | -974,... |
| 4.005 | -335,... |
**Logistic map** is often given as the typical example of a chaotic system. It is the series defined as *x[n + 1] = r * (1 - x[n])*, which for some constant *r* (interpreted as speed of population increase) says how a population evolves from some starting value *x[0]*; for low *x[n]* the population will be increasing proportionally by the rate of *r* but once it reaches a higher value, it will start decreasing (as if by starvation), resulting in oscillation. Now if we only start to be interested in changing the value *r* and then seeing at what value the population stabilizes (for a big *n*), we make some interesting discoveries. This is best seen by plotting the stable values (let's say *x[1000]*) depending on *r*. For *r* approximately between 3.57 and 4 we start to see a chaotic behavior, with results greatly depending on the initial population value (*x[0]*). This demonstrates chaotic behavior.
The following is a [fixed point](fixed_point.md) [C](c.md) implementation of the above:
```
#include <stdio.h>
#define FP_UNIT 256
#define DOWNSCALE_X 4
#define DOWNSCALE_Y 25
#define LINE_LENGTH (FP_UNIT / DOWNSCALE_X)
#define GENERATIONS 1000
char stablePoints[LINE_LENGTH + 1];
int main(void)
{
stablePoints[LINE_LENGTH] = 0; // string terminator
for (int i = 0; i <= FP_UNIT * 4; i += DOWNSCALE_Y) // for different rs
{
for (int j = 0; j < LINE_LENGTH; ++j)
stablePoints[j] = ' ';
for (int j = 0; j < FP_UNIT; ++j) // for different starting population sizes
{
int population = j;
for (int k = 0; k < GENERATIONS; ++k)
population = (i * population * (FP_UNIT - population)) / (FP_UNIT * FP_UNIT);
population /= DOWNSCALE_X;
if (population >= 0 && population < LINE_LENGTH)
stablePoints[population] = '*';
}
printf("%.3f| %s\n",i / ((float) FP_UNIT),stablePoints);
}
return 0;
}
```
It outputs the following:
```
0.000| *
0.098| *
0.195| *
0.293| *
0.391| *
0.488| *
0.586| *
0.684| *
0.781| *
0.879| *
0.977| *
1.074| *****
1.172| ** ***
1.270| ** **
1.367| * **
1.465| * *
1.562| * **
1.660| * *
1.758| * *
1.855| * *
1.953| * *
2.051| * *
2.148| * *
2.246| * *
2.344| * *
2.441| * *
2.539| * *
2.637| * *
2.734| * *
2.832| * *
2.930| * **
3.027| * *********
3.125| * * * *
3.223| * * * *
3.320| * * **
3.418| * ** * **
3.516| * ** * * ** * *****
3.613| * **** *** * * ** * * * ********
3.711| * ** ** ** ***** * **
3.809| * * ** * * * * * * * *** *
3.906| * * * *** * * * * * *** *
```
Vertical axis is the *r* parameter, i.e. the population growth speed. Horizontal axis shows stable population size after 1000 generations, starting with different initial population sizes. We can see that up until about *r = 3* the stable population size always stabilizes at around the same size, which gradually increases with *r*. However then the line splits and after around *r = 3.56* the stable population sizes are quite spread out and unpredictable, greatly depending on the initial population size. Pure CHAOS!

137
chess.md
View file

@ -23,6 +23,13 @@ Chess as a game is not and cannot be [copyrighted](copyright.md), but **can ches
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). A game of chess is so interesting in itself that chess is usually not played for money like many other games ([poker](poker.md), [backgammon](backgammon.md), ...).
The mastery of chess is often divided into two main areas (it is also common to divide strong players into these two categories depending on where their main strength lies):
- **positional play**: Long term, big picture patterns that offer many advantages and opportunities for playing good moves, trying to get a "good position" with men on strong squares, controlling key parts of the board, putting pressure on enemy, ensuring safety of own king etc.
- **tactical play**: Short term, quick action, tricks and calculation skills that win advantages, often material, with tools like forks, pins, discovery checks, sacrifices etc.
Of course this is not the only possible division, another one may be for example offensive vs defensive play etc., but generally chess revolves around position and tactics.
A single game of chess is seen as consisting of three stages: **opening** (starting, theoretical "book" moves, developing men), **middlegame** (seen as the pure core of the game) and **endgame** (ending in which only relatively few men remain on the board). There is no clear border between these stages and they are sometimes defined differently, however each stage plays a bit differently and may require different skills and strategies; for example in the endgame king becomes an active man while in the opening and middlegame he tries to stay hidden and safe.
The study of chess openings is called **opening theory** or just *theory*. Playing the opening stage is special by being based on memorization of this theory, i.e. hundreds or even thousands of existing opening lines that have been studied and analyzed by computers, rather than by performing mental calculation (logical "thinking ahead" present in middlegame and endgame). Some see this as weakness of chess that makes players spend extreme energy on pure memorization. One of the best and most famous players, Bobby Fischer, was of this opinion and has created a chess variant with randomized starting position that prevents such memorization, so called *chess 960*.
@ -47,78 +54,19 @@ On **perfect play**: as stated, chess is unlikely to be ever solved so it is unk
Chess is a big topic in computer science and programming, computers not only help people play chess, train their skills, analyze positions and perform research of games, but they also allow mathematical analysis of chess and provide a platform for things such as [artificial intelligence](ai.md).
Chess software is usually separated to **libraries**, **chess engines** and **frontends** (or boards). Chess engine is typically a [CLI](cli.md) program capable of playing chess but also doing other things such as evaluating arbitrary position, hinting best moves, saving and loading games etc. Frontends on the other hand are [GUI](gui.md) programs that help people interact with the underlying engine.
Chess software is usually separated to **[libraries](library.md)**, **chess engines** and **[frontends](frontend.md)**. Chess engine is typically a [CLI](cli.md) program capable of playing chess but also doing other things such as evaluating arbitrary position, hinting best moves, saving and loading games etc. -- commonly the engine has some kind of custom CLI interface (flags, interactive commands it understands, ...) plus a support of some standardized text communication protocol, most notably XBoard (older one, more [KISS](kiss.md)) and UCI (newer, more [bloated](bloat.md)). There is also typically support for standardized formats such as FEN (way of encoding a chess position as a text string), PGN (way of encoding games as text strings) etc. Frontends on the other hand are usually [GUI](gui.md) programs (in this case also called *boards*) that help people interact with the underlying engine, however there may also be similar non-GUI programs of this type, e.g. those that automatically run tournaments of multiple engines.
For communication between different engines and frontends there exist standards such as XBoard (engine [protocol](protocol.md)), UCI (another engine protocol), FEN (way of encoding a position as a string), PGN (way of encoding games as strings) etc.
Computers have already surpassed the best humans in their playing strength (we can't exactly compute an engine's Elo as it depends on hardware used, but generally the strongest would rate high above 3000 FIDE). As of 2021 the strongest chess engine is considered to be the [FOSS](foss.md) engine [Stockfish](stockfish.md), with other strong engines being e.g. Leela Chess Zero (also FOSS) or AlphaZero ([proprietary](proprietary.md), by [Google](google.md)). [GNU Chess](gnu_chess.md) is a pretty strong [free software](free_software.md) engine by [GNU](gnu.md). There are world championships for chess engines such as the *Top Chess Engine Championship* or *World Computer Chess Championship*. [CCRL](https://ccrl.chessdom.com/ccrl/4040/) is a list of chess engines along with their Elo ratings. Despite the immense strength of modern engines, there are still very specific situation in which humans beat the computer (shown e.g. in [this](https://www.youtube.com/watch?v=R9IZWgArWUE) video).
Computers have already surpassed the best humans in their playing strength (we can't exactly compute an engine's [Elo](elo.md) as it depends on hardware used, but generally the strongest would rate high above 3000 FIDE). As of 2023 the strongest chess engine is widely agreed to be the [FOSS](foss.md) engine [Stockfish](stockfish.md), with other strong engines being e.g. Leela Chess Zero (also FOSS), AlphaZero ([proprietary](proprietary.md) by [Google](google.md)) or Komodo Dragon (proprietary). [GNU Chess](gnu_chess.md) is a pretty strong [free software](free_software.md) engine by [GNU](gnu.md). There are world championships for chess engines such as the *Top Chess Engine Championship* or *World Computer Chess Championship*. [CCRL](https://ccrl.chessdom.com/ccrl/4040/) is a list of chess engines along with their Elo ratings deduced from tournaments they run. Despite the immense strength of modern engines, there are still some specific artificial situations in which a human beats the computer (shown e.g. in [this](https://www.youtube.com/watch?v=R9IZWgArWUE) video); this probably won't last long though.
The first chess computer that beat the world champion (at the time Gary Kasparov) was famously [Deep Blue](deep_blue.md) in 1997. [Alan Turing](turing.md) himself has written a chess playing algorithm but at his time there were no computers to run it, so he executed it by hand -- nowadays the algorithm has been implemented on computers (there are bots playing this algorithm e.g. on lichess).
For online chess there exist many servers such as https://chess.com or https://chess24.com, but for us the most important is https://lichess.org which is gratis and uses [FOSS](foss.md) (it also allows users to run bots under special accounts which is an amazing way of testing engines against people and other engines). These servers rate players with Elo/Glicko, allow them to play with each other or against computer, solve puzzles, analyze games, play chess variants, explore opening databases etc.
Playing strength is not the only possible measure of chess engine quality, of course -- for example there are people who try to make the **smallest chess programs** (see [countercomplex](countercomplex.md) and [golfing](golf.md)). As of 2022 the leading programmer of smallest chess programs seems to be Óscar Toledo G. (https://nanochess.org/chess.html). Unfortunately his programs are [proprietary](proprietary.md), even though their source code is public. The programs include Toledo Atomchess (392 [x86](x86.md) instructions), Toledo Nanochess (world's smallest [C](c.md) chess program, 1257 non-blank C characters) and Toledo Javascript chess (world's smallest [Javascript](javascript.md) chess program). He won the [IOCCC](ioccc.md). Another small chess program is micro-Max by H. G. Muller (https://home.hccnet.nl/h.g.muller/max-src2.html, 1433 C characters, Toledo claims it is weaker than his program).
Playing strength is not the only possible measure of chess engine quality, of course -- for example there are people who try to make the **smallest chess programs** (see [countercomplex](countercomplex.md) and [golfing](golf.md)). As of 2022 the leading programmer of smallest chess programs seems to be Óscar Toledo G. (https://nanochess.org/chess.html). Unfortunately his programs are [proprietary](proprietary.md), even though their source code is public. The programs include Toledo Atomchess (392 [x86](x86.md) instructions), Toledo Nanochess (world's smallest [C](c.md) chess program, 1257 non-blank C characters) and Toledo Javascript chess (world's smallest [Javascript](javascript.md) chess program). He won the [IOCCC](ioccc.md). Another small chess program is micro-Max by H. G. Muller (https://home.hccnet.nl/h.g.muller/max-src2.html, 1433 C characters, Toledo claims it is weaker than his program). Other engines try to be strong while imitating human play (making human moves, even mistakes), most notably Maia which trains several neural networks that play like different rated human players.
{ Nanochess is actually pretty strong, in my testing it easily beat [smallchesslib](smallchesslib.md) Q_Q ~drummyfish }
## Stats And Records
Chess stats are pretty [interesting](interesting.md).
{ Some chess world records are here: https://timkr.home.xs4all.nl/records/records.htm. ~drummyfish }
**Number of possible games** is not known exactly, Shannon estimated it at 10^120 (lower bound, known as *Shannon number*). Number of possible games by plies played is 20 after 1, 400 after 2, 8902 after 3, 197281 after 4, 4865609 after 5, and 2015099950053364471960 after 15.
Similarly the **number of possibly reachable positions** (position for which so called *proof game* exists) is not known exactly, it is estimated to at least 10^40 and 10^50 at most. Numbers of possible positions by plies is 20 after 1, 400 after 2, 5362 after 3, 72078 after 4, 822518 after 5, and 726155461002 after 11.
**Shortest possible checkmate** is by black on ply number 4 (so called *fool's mate*). As of 2022 the **longest known forced checkmate** is in 549 moves -- it has been discovered when computing the Lomonosov Tablebases.
Average game of chess lasts 40 moves. **Average [branching factor](branching_factor.md)** (number of possible moves at a time) is around 33. **Maximum number of possible moves in a position** seems to be 218 (FEN: `R6R/3Q4/1Q4Q1/4Q3/2Q4Q/Q4Q2/pp1Q4/kBNN1KB1 w - - 0 1`).
White wins about 38% of games, black wins about 34%, the remaining 28% are draws.
What is the **longest possible game**? It depends on the exact rules and details we set, for example if a 50 move rule applies, a player MAY claim a draw but also doesn't have to -- but if neither player ever claims a draw, a game can be played infinitely -- so we have to address details such as this. Nevertheless the longest possible chess game upon certain rules has been computed by [Tom7](tom7.md) at 17697 half moves in a paper for [SIGBOVIK](sigbovik.md) 2020. Chess programming wiki states 11798 half moves as the maximum length of a chess game which considers a 50 move rule (1966 publication).
The **longest game played in practice** is considered to be the one between Nikolic and Arsovic from 1989, a draw with 269 moves lasting over 20 hours. For a shortest game there have been ones with zero moves; serious decisive shortest game has occurred multiple times like this: `1.d4 Nf6 2.Bg5 c6 3.e3 Qa5+` (white resigned).
**Best player ever**: a 2017 paper called *Who is the Master?* analyzed 20 of the top players of history based on how good their moves were compared to Stockfish, the strongest engine. The resulting top 10 is (from best): Carlsen, Kramnik, Fischer, Kasparov, Anand, Khalifman, Smyslov, Petrosian, Karpov, Kasimdzhanov. It also confirmed that the quality of chess play at top level has been greatly increasing.
What's **the most typical game**? We can try to construct such a game from a game database by always picking the most common move in given position. Using the lichess database at the time of writing, we get the following incomplete game (the remainder of the game is split between four games, 2 won by white, 1 by black, 1 drawn):
```
1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4
6. cxd4 Bb4+ 7. Nc3 Nxe4 8. O-O Bxc3 9. d5 Bf6 10. Re1 Ne7
11. Rxe4 d6 12. Bg5 Bxg5 13. Nxg5 h6 14. Qe2 hxg5
15. Re1 Be6 16. dxe6 f6 17. Re3 c6 18. Rh3 Rxh3
19. gxh3 g6 20. Qf3 Qa5 21. Rd1 Qf5 22. Qb3 O-O-O
23. Qa3 Qc5 24. Qb3 d5 25. Bf1
```
You can try to derive your own stats, there are huge free game databases such as the Lichess [CC0](cc0.md) database of billions of games from their server.
## Variants
Besides similar games such as [shogi](shogi.md) there are many variants of chess, i.e. slight modifications of rules, foremost worth mentioning is for example chess 960. The following is a list of some variants:
- **antichess** ([suicide](suicide.md), ...): The goal is to lose all men or get stalemated, rules are a bit changed, e.g. castling and checks are removed and taking is forced.
- **chess 960** aka **Fischer's random**: Starting position is randomly modified by shuffling the non-pawn rows (with these rules: king must be between rooks, bishops on opposite colors and black/white's positions are mirrored). The rules are the same with a slight modification to castling. This was invented by Bobby Fischer to emphasize pure chess skill as opposed to memorizing the best opening moves, he saw the opening theory as harmful to chess. Chess 960 is nowadays even advocated by some to become the "main" version of chess.
- **[chess boxing](chess_boxing.md)**: Chess combined with box, players switch between the two games, one wins either by checkmate or knockout.
- **crazyhouse**: When a player captures a man, it goes into his reserve. From the reserve a man can be dropped (as a man of the current player's color) to an empty square instead of making a normal move. This is a rule taken from [shogi](shogi.md).
- **different men**: Some variants use different men, e.g. empress (moves like rook and knight) or amazon (queen/knight).
- **duck chess**: After each move players place a duck on an empty square, the duck blocks the square. The duck cannot be left on the same square, it has to be moved. There are no checks, players win by capturing the king.
- **fog of war**: Makes chess an incomplete-information game by allowing players to only see squares they can immediately move to (this is similarly to some strategy video games).
- **horde chess**: Asymmetric starting position: large number of black pawns vs a white army of traditional men. Rules are slightly modified, e.g. black can only be defeated by having all pawns captured (there is no black king).
- **infinite chess**: Infinite chessboard.
- **minichess**: Smaller chessboard, e.g. 4x4, 4x8 etc. Los Alamos chess is played at 6x6 board without bishops (also no promotion to bishop, no pawn double step, no en passant, no castling). Some are already solved (e.g. 3x3).
- **more players**: E.g. 3 man chess or 4 player chess allow more than two players to play, some use different boards.
- **old chess**: The rules of chess itself have been changing over time (e.g. adding the 50 move rule etc.). The older rule sets can be seen as variants as well.
- **puzzle**: For single player, chess positions are presented and the player has to find the best move or sequence of moves.
- **racing kings**: The starting position has both players on the same side, the goal is to get one's king to the other side first.
- **[non-Euclidean](non_euclidean.md)**: different geometries of the board, e.g. [hyperbolic](hyperbolic.md) or [spherical](spherical.md).
- **3D chess**: [3D](3d.md) generalization of chess.
- **randomly chosen variant**: Here a chess variant to be played is chosen at random before the game, e.g. by dice roll. { This is an idea I got, not sure if this exists or has a different name. ~drummyfish }
## Programming Chess
### Programming Chess
NOTE: our [smallchesslib](smallchesslib.md)/smolchess engine is very simple, educational and can hopefully serve you as a nice study tool to start with :)
@ -140,6 +88,47 @@ Exhaustively searching the tree to great depths is not possible even with most p
Many other aspects come into the AI design such as opening books (databases of best opening moves), endgame tablebases (precomputed databases of winning moves in simple endgames), clock management, pondering (thinking on opponent's move), learning from played games etc. For details see the above linked chess programming wiki.
### Notable Chess Engines/Computers/Entities
TODO: table
## Stats And Records
Chess stats are pretty [interesting](interesting.md).
{ Some chess world records are here: https://timkr.home.xs4all.nl/records/records.htm. ~drummyfish }
**Number of possible games** is not known exactly, Shannon estimated it at 10^120 (lower bound, known as *Shannon number*). Number of possible games by plies played is 20 after 1, 400 after 2, 8902 after 3, 197281 after 4, 4865609 after 5, and 2015099950053364471960 after 15.
Similarly the **number of possibly reachable positions** (position for which so called *proof game* exists) is not known exactly, it is estimated to at least 10^40 and 10^50 at most. Numbers of possible positions by plies is 20 after 1, 400 after 2, 5362 after 3, 72078 after 4, 822518 after 5, and 726155461002 after 11.
**Shortest possible checkmate** is by black on ply number 4 (so called *fool's mate*). As of 2022 the **longest known forced checkmate** is in 549 moves -- it has been discovered when computing the Lomonosov Tablebases.
Average game of chess lasts 40 moves. **Average [branching factor](branching_factor.md)** (number of possible moves at a time) is around 33. **Maximum number of possible moves in a position** seems to be 218 (FEN: `R6R/3Q4/1Q4Q1/4Q3/2Q4Q/Q4Q2/pp1Q4/kBNN1KB1 w - - 0 1`).
White wins about 38% of games, black wins about 34%, the remaining 28% are draws (38.7%, 31.1%, 30.3% respectively on Computer Chess Rating Lists).
What is the **longest possible game**? It depends on the exact rules and details we set, for example if a 50 move rule applies, a player MAY claim a draw but also doesn't have to -- but if neither player ever claims a draw, a game can be played infinitely -- so we have to address details such as this. Nevertheless the longest possible chess game upon certain rules has been computed by [Tom7](tom7.md) at 17697 half moves in a paper for [SIGBOVIK](sigbovik.md) 2020. Chess programming wiki states 11798 half moves as the maximum length of a chess game which considers a 50 move rule (1966 publication).
The **longest game played in practice** is considered to be the one between Nikolic and Arsovic from 1989, a draw with 269 moves lasting over 20 hours. For a shortest game there have been ones with zero moves; serious decisive shortest game has occurred multiple times like this: `1.d4 Nf6 2.Bg5 c6 3.e3 Qa5+` (white resigned).
**Best player ever**: a 2017 paper called *Who is the Master?* analyzed 20 of the top players of history based on how good their moves were compared to Stockfish, the strongest engine. The resulting top 10 is (from best): Carlsen, Kramnik, Fischer, Kasparov, Anand, Khalifman, Smyslov, Petrosian, Karpov, Kasimdzhanov. It also confirmed that the quality of chess play at top level has been greatly increasing.
What's **the most typical game**? We can try to construct such a game from a game database by always picking the most common move in given position. Using the lichess database at the time of writing, we get the following incomplete game (the remainder of the game is split between four games, 2 won by white, 1 by black, 1 drawn):
```
1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4
6. cxd4 Bb4+ 7. Nc3 Nxe4 8. O-O Bxc3 9. d5 Bf6 10. Re1 Ne7
11. Rxe4 d6 12. Bg5 Bxg5 13. Nxg5 h6 14. Qe2 hxg5
15. Re1 Be6 16. dxe6 f6 17. Re3 c6 18. Rh3 Rxh3
19. gxh3 g6 20. Qf3 Qa5 21. Rd1 Qf5 22. Qb3 O-O-O
23. Qa3 Qc5 24. Qb3 d5 25. Bf1
```
You can try to derive your own stats, there are huge free game databases such as the Lichess [CC0](cc0.md) database of billions of games from their server.
{ TODO: Derive stats about the best move, i.e. for example "best move is usually by queen by three squares" or something like that. Could this actually help the play somehow? Maybe could be used for move ordering in alpha-beta. ~drummyfish }
## Rules
The exact rules of chess and their scope may depend on situation, this is just a sum up of rules generally used nowadays.
@ -189,6 +178,28 @@ A player cannot make a move that would leave him in check!
Threefold repetition is a rule allowing a player to claim a draw if the same position (men 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 man has been captured in last 50 moves (both players making their move counts as a single move here).
### Variants
Besides similar games such as [shogi](shogi.md) there are many variants of chess, i.e. slight modifications of rules, foremost worth mentioning is for example chess 960. The following is a list of some variants:
- **antichess** ([suicide](suicide.md), ...): The goal is to lose all men or get stalemated, rules are a bit changed, e.g. castling and checks are removed and taking is forced.
- **chess 960** aka **Fischer's random**: Starting position is randomly modified by shuffling the non-pawn rows (with these rules: king must be between rooks, bishops on opposite colors and black/white's positions are mirrored). The rules are the same with a slight modification to castling. This was invented by Bobby Fischer to emphasize pure chess skill as opposed to memorizing the best opening moves, he saw the opening theory as harmful to chess. Chess 960 is nowadays even advocated by some to become the "main" version of chess.
- **[chess boxing](chess_boxing.md)**: Chess combined with box, players switch between the two games, one wins either by checkmate or knockout.
- **crazyhouse**: When a player captures a man, it goes into his reserve. From the reserve a man can be dropped (as a man of the current player's color) to an empty square instead of making a normal move. This is a rule taken from [shogi](shogi.md).
- **different men**: Some variants use different men, e.g. empress (moves like rook and knight) or amazon (queen/knight).
- **duck chess**: After each move players place a duck on an empty square, the duck blocks the square. The duck cannot be left on the same square, it has to be moved. There are no checks, players win by capturing the king.
- **fog of war**: Makes chess an incomplete-information game by allowing players to only see squares they can immediately move to (this is similarly to some strategy video games).
- **horde chess**: Asymmetric starting position: large number of black pawns vs a white army of traditional men. Rules are slightly modified, e.g. black can only be defeated by having all pawns captured (there is no black king).
- **infinite chess**: Infinite chessboard.
- **minichess**: Smaller chessboard, e.g. 4x4, 4x8 etc. Los Alamos chess is played at 6x6 board without bishops (also no promotion to bishop, no pawn double step, no en passant, no castling). Some are already solved (e.g. 3x3).
- **more players**: E.g. 3 man chess or 4 player chess allow more than two players to play, some use different boards.
- **old chess**: The rules of chess itself have been changing over time (e.g. adding the 50 move rule etc.). The older rule sets can be seen as variants as well.
- **puzzle**: For single player, chess positions are presented and the player has to find the best move or sequence of moves.
- **racing kings**: The starting position has both players on the same side, the goal is to get one's king to the other side first.
- **[non-Euclidean](non_euclidean.md)**: different geometries of the board, e.g. [hyperbolic](hyperbolic.md) or [spherical](spherical.md).
- **3D chess**: [3D](3d.md) generalization of chess.
- **randomly chosen variant**: Here a chess variant to be played is chosen at random before the game, e.g. by dice roll. { This is an idea I got, not sure if this exists or has a different name. ~drummyfish }
## Playing Tips
Some general tips and rules of thumb, mostly for beginners:

4
elo.md
View file

@ -26,6 +26,10 @@ After playing a game the ratings of the two players are adjusted depending on th
where *R* is the outcome of the game (for player 1, i.e. 1 for a win, 0 for loss, 0.5 for a draw) and *K* is the change rate which affects how quickly the ratings will change (can be set to e.g. 30 but may be different e.g. for new or low rated players). So with e.g. *K = 25* if for our two players the game ends up being a draw, player 2 takes 9 points from player 1 (*A2 = 1691*, *B2 = 1409*, note that drawing a weaker player is below the expected result).
**How to compute Elo difference from a number of games?** This is useful e.g. if we have a chess engine X with Elo EX and a new engine Y whose Elo we don't know: we may let these two engines play 1000 games, note the average result *E* and then compute the Elo difference of the new engine against the first engine from this formula (derived from the above formula by solving for Elo difference *B - A*):
*B - A = log10(1 / E - 1) * 400*
## Some Code
Here is a [C](c.md) code that simulates players of different skills playing games and being rated with Elo. Keep in mind the example is simple, it uses the potentially imperfect `rand` function etc., but it shows the principle quite well. At the beginning each player is assigned an Elo of 1000 and a random skill which is [normally distrubuted](normal_distribution.md), a game between two players consists of each player drawing a random number in range from from 1 to his skill number, the player that draws a bigger number wins (i.e. a player with higher skill is more likely to win).

2
go.md
View file

@ -16,6 +16,8 @@ Go (from Japanese *Igo*, "surrounding board game", also *Baduk* or *Wei-qi*) is
**Solving go:** similarly to chess the full game of go seems unlikely to be solved -- the 19x19 board makes the game state tree yet larger than that of chess, but the much simpler rules possibly give a bigger hope for mathematical proofs. Smaller boards however have been solved: Erik van der Werf made a program that confirmed win for black on boards up to (and including) 5x5 (best first move in all cases being in the middle of the board). Bigger boards are being researched, but a lot of information about them is in undecipherable Japanese/Korean gibberish, so we leave that for the future.
A famous proverb about go goes like this: what is the most perfect game man ever invented? Chess! But what about go? Go existed long before man...
TODO: rating, programming, stats, programs and sites for playing, ...
## Rules

View file

@ -2,7 +2,7 @@
*Not to be confused with [cracking](cracking.md).*
Hacking (also hackerdom) in the widest sense means exploiting usually (but not necessarily) a [computer](computer.md) [system](system.md) in a clever way. In context of computers the word *hacker* was originally -- that is in 1960s -- used for very good [programmers](programming.md) and people who were simply good with computers, the word *hacking* had a completely positive meaning; hacker could almost be synonymous with computer [genius](genius.md) (at the time people handling computers were usually physicists, engineers or mathematicians), someone who enjoyed handling and programming computers and could playfully look for very clever ways of making them do what he wanted. Over time hackers evolved a whole **hacker culture** with its own slang, set of values, behavioral and ethical norms, in jokes and rich lore. As time marched on, computer [security](security.md) has started to become an important topic and some media started to use the word *hacker* for someone breaking into a computer system and so the word gained a negative connotation in the mainstream -- though many refused to accept this new meaning and rather used the word *[cracker](cracker.md)* for a "malicious hacker", there appeared new variants such as *white hat* and *black hat* hacker, referring to ethical and malicious hackers. With onset of online [games](game.md) the word *hacking* even became a synonym for [cheating](cheating.md). The original positive meaning has recently seen some comeback with popularity of sites such as [hacker news](hacker_news.md) or hackaday, the word *life hack* has even found its way into the non-computer mainstream dictionary, however a "[modern](modern.md) hacker" is a bit different from the oldschool hacker, usually for the worse (for example a modern self proclaimed "hacker" has no issue with wearing a [suit](suit.md), something that would be despised by an oldschool hacker). We, [LRS](lrs.md), advocate for using the original, oldschool meaning of the word *hacker*.
Hacking (also hackerdom) in the widest sense means exploiting usually (but not necessarily) a [computer](computer.md) [system](system.md) in a clever, "thinking outside the box" way. In context of computers the word *hacker* was originally -- that is in 1960s -- used for very good [programmers](programming.md) and people who were simply good with computers, the word *hacking* had a completely positive meaning; hacker could almost be synonymous with computer [genius](genius.md) (at the time people handling computers were usually physicists, engineers or mathematicians), someone who enjoyed handling and programming computers and could playfully look for very clever ways of making them do what he wanted. Over time hackers evolved a whole **hacker culture** with its own slang, set of values, behavioral and ethical norms, in jokes and rich lore. As time marched on, computer [security](security.md) has started to become an important topic and some media started to use the word *hacker* for someone breaking into a computer system and so the word gained a negative connotation in the mainstream -- though many refused to accept this new meaning and rather used the word *[cracker](cracker.md)* for a "malicious hacker", there appeared new variants such as *white hat* and *black hat* hacker, referring to ethical and malicious hackers. With onset of online [games](game.md) the word *hacking* even became a synonym for [cheating](cheating.md). The original positive meaning has recently seen some comeback with popularity of sites such as [hacker news](hacker_news.md) or hackaday, the word *life hack* has even found its way into the non-computer mainstream dictionary, however a "[modern](modern.md) hacker" is a bit different from the oldschool hacker, usually for the worse (for example a modern self proclaimed "hacker" has no issue with wearing a [suit](suit.md), something that would be despised by an oldschool hacker). We, [LRS](lrs.md), advocate for using the original, oldschool meaning of the word *hacker*.
## Original Hacker Culture
@ -25,7 +25,7 @@ As a symbol of hackerdom the glider symbol from [game of life](game_of_life.md)
Let us now attempt to briefly summarize what it means to be a hacker:
- **Hacker is an artist who builds and creates**, [cracker](cracker.md) is someone who breaks and destroys, many times due to being less competent or unworthy of true hacking -- destroying something is easier than creating something.
- **Hacker is a kind of artist who builds and creates** (though not every artist is a hacker!), [cracker](cracker.md) is someone who breaks and destroys, many times due to being less competent or unworthy of true hacking -- destroying something is easier than creating something.
- **Hacker greatly values freedom**, among which are the **freedom of [information](information.dm)**, **[free software](free_software.md)**, **[free speech](free_speech.md)**, **free thinking**, free access to computers etc. Therefore he supports sharing, even if it is called for example "[piracy](piracy.md)", and despises things going against said freedoms such as [proprietary](proprietary.md) software, [passwords](password.md) (preventing information freedom), [censorship](censorship.md), [copyright](copyright.md), [patents](patent.md), pretense and deceit etc.
- **Hackers are non-conformists, reject authority and don't respect social norms**; a hacker wears old cheap clothes, long hair and unkept beard without conforming to any fashion, he sees caring about looks as a wasted time that would better be spent by hacking computers. Hacker is a basement dwelling nerd without social life because he has rich inner intellectual life, he's usually a kisless virgin, even a [wizard](wizard.md), partly because of his looks but also again because typical adult life would require him to do less hacking.
- **Hacker values [fun](fun.md) and playfulness** -- despite his serious dedication to the art, he hates seriousness of the business guys and "suits", as well as the self-centered, egoistic attitude of "modern hackers" who might see or present themselves as kind of [superheroes](hero_culture.md). A hacker will give his programs funny names rather than names that would make for a good business product, a hacker will insert jokes in his source code (e.g. [hex](hexadecimal.md) values such as 0xBEEFFACE), documentation and speech ([Jargon File](jargon_file.md) has a whole section on how hackers construct and use words).
@ -60,6 +60,7 @@ A great many commonly used tricks in programming could be regarded as hacks even
- **[quine](quine.md)**: A cleverly constructed self-replicating program in [programming language](programming_language.md) that prints its own source code -- this is a common exercise of language hackers.
- **MetaGolfScript [esoteric languages](esolang.md)**: rather than being a nicely designed [code golfing](code_golf.md) language MetaGolfScript invents infinitely many languages, each of which solves one problem with a zero-length program, making it possible to win any golfing contest that allows arbitrary choice of language just by choosing the correct MetaGolfScript language.
- **Appending "in Minecraft" to avoid legal responsibility**: some people try to avoid legal responsibility for threats by talking about the situation as if it was harmlessly happening in a video game such as Minecraft, for example "Bitch I'm going to come to your house and murder you in sleep, in Minecraft." Though this is a nice hack and should work, the dystopian governments can do whatever they want and still arrest you for this -- this happened e.g. in New Jersey when one guy threatened to kill a sheriff like this.
- [Richard Stallman](rms.md) called some musical compositions hacks, specifically 4'33 (just silence) and Ma Fin Est Mon Commencement ([palindromic](palindrome.md) music).
- TODO: moar
## See Also

View file

@ -23,7 +23,7 @@ An important issue of many ideologies/philosophies/religions/etc. has shown to b
Examples from LRS point of view:
- Is it OK to ever use violence? Here LRS takes the extremist way of strongly saying no -- according to us violence is always bad and we definte this as an [axiom](axiom.md), something without a need of proof, it is the very foundation of our movement and not acknowledging it would simply mean it's not LRS anymore. However a bit of moderacy may also appear here; if for example someone uses violence in a desperate attempt to protect one's child, though we won't embrace the action we won't condemn the man either -- he committed a "sin", did something wrong, but in his situation there was really no right thing to do, so what should we blame him for, for being a subject of unfortunate situation?
- Is it OK to ever use violence? Here LRS takes the extremist way of strongly saying no -- according to us violence is always bad and we define this as an [axiom](axiom.md), something without a need of proof, it is the very foundation of our movement and not acknowledging it would simply mean it's not LRS anymore. However a bit of moderacy may also appear here; if for example someone uses violence in a desperate attempt to protect one's child, though we won't embrace the action we won't condemn the man either -- he committed a "sin", did something wrong, but in his situation there was really no right thing to do, so what should we blame him for, for being a subject of unfortunate situation?
- Is it OK to sometimes use proprietary software? Here for example [Richard Stallman](rms.md)/FSF/[GNU](gnu.md) take the extremist stance and say no, proprietary software is the literal [devil](devil.md) and though shalt evade it for all cost (in fact GNU will put effort in purposefully breaking compatibility with proprietary software, which is borderline capitalist behavior similar to artificial obsolescence etc.). While we agree it is a good general rule to avoid software whose purpose is almost exclusively the abuse of its user, we may be more tolerant and allow breaking the rule sometimes, because to us proprietary software is nothing set in any axiom, it is just a symptom resulting from bad society. As a non-axiom it should be a subject to constant reevaluation against the main goal. A simple commandment of "NO TOUCH NOTHING PROPRIETARY" is a good tool for a newcomer, it is a simple to follow rule of thumb that teaches him to find free replacements and alternatives, however once one becomes advanced and eventually a master of the freedom philosophy, he sees things aren't as simple to be solved by one simple rule, just as a master of music knows when to break basic rules of thumb, when to leave the scale, break the rhythm to make excellent music. Here we see it similarly: When touching proprietary software doesn't result in significant harm (such as supporting its developer, becoming addicted to it, getting abused by it, ...) and when it does significant good (e.g. inspires creation of its free clone, reveals the mechanisms by which it abuses its users, ...), it may in fact be good to do so.
- Should you oppose your boss at work, deny to serve him in unethical practice because he is a filthy capitalist and so make trouble for yourself, possibly even get fired for it? Well, this is not so easy again; a strict extremist anticapitalist here would just stay without a job because he couldn't work as any work supports capitalism. On the other hand such a guy would just be homeless, rid of any practical opportunity to create and do good, and would probably die soon anyway. Here it's more or less a question of personal tuning, finding the "least harmful" job, minimizing time spent at it so as to be able to do good in spare time, opposing your boss sometimes but not every single time, not really building a career so that you may quit at any moment etc. Until we have [basic income](ubi.md) or something, you are more or less [doomed](doom.md) to suffer dealing with this on your own sadly.
@ -58,7 +58,7 @@ Firstly **do NOT follow mainstream tutorials on making website** -- these are ab
- **Static site hosting** to store your site on, which will server the site to clients. You have several options here:
- There exist free static site hosting services, e.g. those on many [git](git.md) hosting platforms like [GitLab](gitlab.md) or [Codeberg](codeberg.md) (even [GitHub](github.md), but avoid that one if possible), on [pubnix](pubnix.md) servers such as [tildetown](tildetown.md) or sites like [neocities](neocities.md). Here you may still encounter some censorship, but it can be a good start. Just search their site for details on how to host a site there.
- You may host your site at home, typically using [Raspberry Pi](rpi.md). This doesn't really cost anything as the weaker Raspberrys (e.g. 3B) consume negligible amount of electricity, and for non-extreme traffic you won't even need a super high speed connection (especially considering you will make a very tiny, efficient website). This is a very good option as practically no one will be able to censor you (only police and ISP), but it's also a tiny bit more difficult to set up because firstly you need to set up a webserver ([Apache](apache.md) is usually installed on any GNU/Linux distro though, it's really easy to do) and secondly you NEED A PUBLIC [IP ADDRESS](ip_address.md) (as typically you will be behind a [NAT](nat.md) so that computers from outside can't reach your server): you will probably have to ask your [internet provider](isp.md) for it (maybe you already have it, maybe they will give it to you for free, maybe you'll have to pay some small fee; just ask). Then you will also need to set up port forwarding on your [router](router.md) so that the requests from the outside are redirected to your web server computer (Raspberry Pi) -- this is just done in router settings by entering the IP address of the webserver computer somewhere.
- You may also pay for a [VPS](vps.md) (i.e. a server computer a company runs for you and which you access remotely) which has the same advantages as having your own home server (i.e. being able to host game servers, dynamic websites, [gopher](gopher.md) sites etc.), but we won't cover this here. Renting a VPS in some obscure country may be a good option to host a very controversial site.
- You may also pay for a [VPS](vps.md) (i.e. a server computer a company runs for you and which you access remotely) which has the same advantages as having your own home server (i.e. being able to host game servers, dynamic websites, [gopher](gopher.md) sites etc.), but we won't cover this here. Renting a VPS in some obscure country may be a good option to host a very controversial site. Also VPS may be expensive compared to mere static site hosting. { NOTE: **Check out this cool host**, it looks pretty based: https://www.nearlyfreespeech.net/. They try to be as cheap as possible, you only pay for resources you use, so with a tiny site it may be almost free, and they don't censor content as a rule. Also their site is pretty suckless. An issue may perhaps be when someone DDOSes you and wastes your resources, draining your money pool. ~drummyfish }
- Optionally buy a domain name (search web for domain registrars), for example *mycoolsite.party*. If you are using a free hosting service, you will get a subdomain for free and don't have to care about this (but can still also use your own domain if you have it and want to). If you have your own home server, you probably want to buy a domain because otherwise people would have to connect to your site by literally typing an IP address to the browser. Once you have the domain, you want to edit the [DNS](dns.md) records of your domain to point to the IP address of your server (i.e. you want to add an "A record"): how exactly to do this depends on the registrar (they will have some kinda online system to edit the records).
For starters try to go the easiest way: use some free static site hosting without a domain name. Later, once you get comfortable, you may transition to self-hosting with your custom domain.