master
Miloslav Ciz 8 months ago
parent 67680b9f6c
commit a7d8e4b40d

@ -78,6 +78,7 @@ Here is a list of some acronyms:
- **[DNS](dns.md)** (domain name system)
- **[DOM](dom.md)** (document object model)
- **[DOS](dos.md)** (disk operating system, denial of service)
- **[DOTADIW](dotadiw.md)** (do one thing and do it well)
- **[DPI](dpi.md)** (dots per inch)
- **[DRAM](dram.md)** (dynamic RAM)
- **[DRM](drm.md)** (digital restrictions management)

@ -4,12 +4,14 @@
Unless specified otherwise, this article supposes the C99 standard of the C language.
**Generally**: be sure to check your programs with tools such as [valgrind](valgrind.md), [splint](splint.md) or [cppcheck](cppcheck.md), and turn on compiler auto checks (`-Wall`, `-Wextra`, `-pedantic`, ...), it's quick, simple and reveals many bugs!
**Generally**: be sure to check your programs with tools such as [valgrind](valgrind.md), [splint](splint.md), [cppcheck](cppcheck.md), UBSan or ASan, and turn on compiler auto checks (`-Wall`, `-Wextra`, `-pedantic`, ...), it's quick, simple and reveals many bugs!
## Undefined/Unspecified Behavior
Undefined (completely unpredictable), unspecified (safe but potentially differing) and implementation-defined (consistent within implementation but potentially differing between them) behavior poses a kind of unpredictability and sometimes non-intuitive, tricky behavior of certain operations that may differ between compilers, platforms or runs because they are not exactly described by the language specification; this is mostly done on purpose so as to allow some implementation freedom which allows implementing the language in a way that is most efficient on given platform. One has to be very careful about not letting such behavior break the program on platforms different from the one the program is developed on. Note that tools such as [cppcheck](cppcheck.md) can help find undefined behavior in code. Description of some such behavior follows.
There are tools for detecting undefined behavior, see e.g. [clang](clang.md)'s UBSan (https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html).
**Data type sizes including int and char may not be the same on each platform**. Even though we almost take it for granted that char is 8 bits wide, in theory it can be different (even though `sizeof(char)` is always 1). Int (and unsigned int) type width should reflect the architecture's native integer type, so nowadays it's mostly 32 or 64 bits. To deal with these differences we can use the standard library `limits.h` and `stdint.h` headers.
**No specific [endianness](endian.md) or even encoding of numbers is specified**. Nowadays little endian and [two's complement](twos_complement.md) is what you'll encounter on most platforms, but e.g. [PowerPC](ppc.md) uses big endian ordering.

@ -47,8 +47,6 @@ 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).
There is a great online Wiki focused on programming chess engines: https://www.chessprogramming.org.
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.
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.
@ -122,15 +120,21 @@ Besides similar games such as [shogi](shogi.md) there are many variants of 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 :)
There is also a great online wiki focused on programming chess engines: https://www.chessprogramming.org.
Programming chess is a [fun](fun.md) and enriching experience and is therefore recommended as a good exercise. There is nothing more satisfying than writing a custom chess engine and then watching it play on its own.
The core of chess programming is writing the [AI](ai.md), everything else, i.e. implementing the rules, communication protocols etc., is pretty straightforward (but still a good programming exercise). Nevertheless one has to pay a great attention to eliminating as many bugs as possible; really, the importance of writing automatic tests can't be stressed enough as debugging the AI will be hard enough and can become unmanageable with small bugs creeping in.
The core of chess programming is writing the [AI](ai.md), everything else, i.e. implementing the rules, communication protocols etc., is pretty straightforward (but still a good programming exercise). Nevertheless, as the chess programming wiki stresses, one has to pay a great attention to eliminating as many [bugs](bug.md) as possible; really, the importance of writing automatic tests can't be stressed enough as debugging the AI will be hard enough and can become unmanageable with small bugs creeping in.
The AI itself works traditionally on the following principle: firstly we implement so called static **evaluation function** -- a function that takes a chess position and outputs its evaluation number which says how good the position is for white vs black (positive number favoring white, negative black, zero meaning equal). This function considers a number of factors such as total material of both players, pawn structure, king safety, men mobility and so on. Traditionally this function has been hand-written, nowadays it is being replaced by a learned [neural network](neural_network.md) ([NNUE](nnue.md)) which showed to give superior results (e.g. Stockfish still offers both options); for starters you probably want to write a simple evaluation function manually. Secondly we implement a **search** algorithm -- typically some modification of [minimax](minimax.md) algorithm, e.g. with alpha-beta pruning -- that recursively searches the game tree and looks for a move that will lead to the best result in the future, i.e. to position for which the evaluation function gives the best value. This basic principle, especially the search part, can get very complex as there are many possible weaknesses and optimizations.
The AI itself works in almost all cases on the same principle: firstly we implement so called static **evaluation function** -- a function that takes a chess position and outputs its evaluation number which say how good the position is for white vs black (positive number favoring white, negative black). This function considers a number of factors such as total material of both players, pawn structure, king safety, men mobility and so on (in new engines this function is often a learned [neural network](neural_network.md), but it may very well be written by hand). Secondly we implement a **search** algorithm -- typically some modification of [minimax](minimax.md) algorithm -- that recursively searches the game tree and looks for a move that will lead to the best result, i.e. to position for which the evaluation function gives the best value. This basic principle, especially the search part, gets very complex as there are many possible weaknesses and optimizations.
Exhaustively searching the tree to great depths is not possible even with most powerful hardware due to astronomical numbers of possible move combinations, so the engine has to limit the depth quite greatly and use various [hacks](hacking.md), [approximations](approximation.md), [heuristics](heuristic.md) etc.. Normally it will search all moves to a small depth (e.g. 2 or 3 half moves or *plys*) and then extend the search for interesting moves such as exchanges or checks. Maybe the greatest danger of searching algorithms is so called **horizon effect** which has to be addressed somehow (e.g. by detecting quiet positions, so called *quiescence*). If not addressed, the horizon effect will make an engine misevaluate certain moves by stopping the evaluation at certain depth even if the played out situation would continue and lead to a vastly different result (imagine e.g. a queen taking a pawn which is guarded by another pawn; if the engine stops evaluating after the pawn take, it will think it's a won pawn, when in fact it's a lost queen). There are also many techniques for reducing the number of searched tree nodes and speeding up the search, for example pruning methods such as **alpha-beta** (which subsequently works best with correctly ordering moves to search), or **transposition tables** (remembering already evaluated position so that they don't have to be evaluated again when encountered by a different path in the tree).
Exhaustively searching the tree to great depths is not possible due to astronomical numbers of possible move combinations, so the engine has to limit the depth quite greatly. Normally it will search all moves to a small depth (e.g. 2 or 3 half moves or *plys*) and then extend the search for interesting moves such as exchanges or checks. Maybe the greatest danger of searching algorithms is so called **horizon effect** which has to be addressed somehow (e.g. by detecting quiet positions, so called *quiescence*). If not addressed, the horizon effect will make an engine misevaluate certain moves by stopping the evaluation at certain depth even if the played out situation would continue and lead to a vastly different result (imagine e.g. a queen taking a pawn which is guarded by another pawn; if the engine stops evaluating after the pawn take, it will think it's a won pawn, when in fact it's a lost queen). There are also many techniques for reducing the number of searched tree nodes and speeding up the search, for example pruning methods such as **alpha-beta** (which subsequently works best with correctly ordering moves to search), or **transposition tables** (remembering already evaluated position so that they don't have to be evaluated again when encountered by a different path in the tree).
**Alternative approaches**: most engines work as described above (search plus evaluation function) with some minor or bigger modifications. The simplest possible stupid AI can just make random moves, which will of course be an extremely weak opponent -- one might perhaps try to just program a few simple rules to make it a bit less stupid and possibly a simple training opponent for complete beginners: the AI may for example pick a few "good looking" candidate moves that are "usually OK" (pushing a pawn, taking a higher value piece, castling, ...) and aren't a complete insanity, then pick one at random only from those (this randomness can further be improved and gradually controlled by scoring the moves somehow and adding a more or less random value from some range to each score, then picking the moves with highest score). One could also try to just program in a few generic rules such as: checkmate if you can, otherwise take an unprotected piece, otherwise protect your own unprotected piece etc. -- this could produce some beginner level bot. Another idea might be a "Chinese room" bot that doesn't really understand chess but has a huge database of games (which it may even be fetching from some Internet database) and then just looking up what moves good players make in positions that arise on the board, however a database of all positions will never exist, so in case the position is not found there has to be some fallback (e.g. play random move, or somehow find the "most similar position" and use that, ...). As another approach one may try to use some **non neural network [machine learnening](machine_learning.md)**, for example [genetic programming](genetic_programming.md), to train the evaluation function, which will then be used in the tree search. Another idea that's being tried (e.g. in the Maia engine) is **pure neural net AI** (or another form of machine learning) which doesn't use any tree search -- not using search at all has long been thought to be impossible as analyzing a chess position completely statically without any "looking ahead" is extremely difficult, however new neural networks have shown to be extremely good at this kind of thing and pure NN AIs can now play on a master level (a human grandmaster playing ultra bullet is also just a no-calculation, pure pattern recognition play). Next, **[Monte Carlo](monte_carlo.md) tree search** (MCTS) is an alternative way of searching the game tree which may even work without any evaluation function: in it one makes many random playouts (complete games until the end making only random moves) for each checked move and based on the number of wins/losses/draws in those playouts statistically a value is assigned to the move -- the idea is that a move that most often leads to a win is likely the best. Another Monte Carlo approach may just make random playouts, stop at random depth and then use normal static evaluation function (horizon effect is a danger but hopefully its significance should get minimized in the averaging). However MCTS is pretty tricky to do well. MCTS is used e.g. in Komodo Dragon, the engine that's currently among the best. Another approach may lie in somehow using several methods and [heuristics](heuristic.md) to vote on which move would be best.
Many other aspects come into the AI design such as opening books (databases of best opening moves), endgame tablebases (databases of winning moves in simple endgames), heuristics in search, clock management, pondering (thinking on opponent's move), learning from played games etc. For details see the above linked chess programming wiki.
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.
## Rules

@ -9,6 +9,7 @@ The following is a list of common diseases.
- [capitalism](capitalism.md)
- [data hoarding](data_hoarding.md)
- [depression](depression.md)
- [egoism](egoism.md)
- [homosexuality](gay.md)
- hopping:
- [browser hopping](browser_hopping.md)

@ -5,7 +5,7 @@ Type A and type B fails are two very common cases of failing to adhere to the [L
- **type A fail**: Is anticapitalist, anticonsumerist, may incline towards minimalism, supports [free software](free_software.md) and [free culture](free_culture.md), may even be a vegan, [anarchist](anarchism.md), [C](c.md) programmer etc., however falls into the trap of supporting [pseudoleft](pseudoleft.md), e.g. [LGBT](lgbt.md) or [feminism](feminism.md) and things such as censorship ("[moderation](moderation.md)", [COCs](coc.md)), "just violence and bullying" (violence against fascists, e.g. [antifa](antifa.md)), falls for memes such as "[Rust](rust.md) is the new [C](c.md)".
- **type B fail**: Is against [pseudoleft](pseudoleft.md) bullshit and propaganda such as political correctness, is a [racial realist](racial_realism.md), highly supports [suckless](suckless.md) software, hacking and minimalism to achieve high freedom, usually also opposes [corporations](corporation.md) and state, however falls into the trap of being a [fascist](fascism.md), easily accepts violence, believes in "natural selection/wild west as a basis of society", supports and engages in [cryptocurrencies](crypto.md), believes in some form of [capitalism](capitalism.md) and that the current form of it can be "fixed" (["anarcho" capitalism](ancap.md) etc.)
Both types are furthermore prone to falling a victim to [privacy](privacy.md) obsession, [productivity](productivity_culture.md) obsession, [diseases](disease.d) such as [distro hopping](distro_hopping.md), [consuerism](consumerism.md) and similar defects.
Both types are furthermore prone to falling a victim to [privacy](privacy.md) obsession, [productivity](productivity_culture.md) obsession, [hero worshipping](hero_culture.md), [diseases](disease.d) such as [distro hopping](distro_hopping.md), [consuerism](consumerism.md) and similar defects.
Type A/B fails are the "great filter" of the rare kind of people who show a great potential for adhering to LRS. It may be due to the modern western culture that forces a [right](right.md)-[pseudoleft](pseudoleft.md) false dichotomy that even those showing a high degree of non-conformance eventually slip into the trap of being caught by one of the two poles. These two fails seem to be a manifestation of an individual's true motives of [self interest](self_interest.md) which is culturally fueled with great force -- those individuals then try to not conform and support non-mainstream concepts like free culture or sucklessness, but eventually only with the goal of self interest. It seems to be extremely difficult to abandon this goal, much more than simply non-conforming. Maybe it's also the subconscious knowledge that adhering completely to LRS means an extreme loneliness; being type A/B fail means being a part of a minority, but still a having a supportive community, not being completely alone.

@ -50,6 +50,19 @@ If you're new here, you may want to read answers to [frequently asked questions]
STOP [CAPITALISM](capitalism.md) STOP [BLOAT](bloat.md) STOP [censorship](censorship.md) STOP [business](business.md) STOP [bullshit](bs.md) STOP [copyright](copyright.md) STOP [working](work.md) STOP [coding](coding.md) STOP [competing](competition.md) STOP [fighting](fight_culture.md) STOP [consuming](consumerism.md) STOP [producing](productivity_cult.md) STOP [worshiping people](hero_culture.md) STOP [fascism](fascism.md) STOP [economy](economy.md) STOP slavery STOP violence STOP wearing clothes STOP eating animals [STOP being an idiot](unretard.md) etc. Start [loving](love.md), sharing, creating and caring :) <3
```
_______ _ _______ _ _______ _
|_____ | | | |_____ | | | |_____ | | |
| | | | | | | | | | | |
_____| |___| | _____| |___| | _____| |___| |
| ___ _____| | ___ _____| | ___ _____|
| | | | | | | | | | | |
| | | |_____ | | | |_____ | | | |_____
|_| |_______| |_| |_______| |_| |_______|
```
*[Swastika](swastika.md) is a symbol of good fortune and protection from evil.*
## What Is Less Retarded Software/Society?
Well, we're trying to figure this out on this wiki, but less retarded software is greatly related to [suckless](suckless.md), [Unix](unix.md), [KISS](kiss.md), [free](free_software.md), selfless and sustainable software created to maximally help all living beings. LRS stands opposed to all [shittiness](shit.md) of so called ["modern"](modern.md) software. We pursue heading towards an ideal society such as that of the [Venus project](venus_project.md). For more details see the article about [LRS](lrs.md).

@ -8,7 +8,7 @@ Instead of the word *race* the politically correct camp uses words such as *ethn
**Race can be told from the shape of the skull and one's [DNA](dna.md)**, which finds use e.g. in forensics to help solve crimes. It is officially called the *ancestry estimation*. Some idiots say this should be forbidden to do because it's "racist" lmao. Besides the obvious visual difference such as skin color **races also have completely measurable differences acknowledged even by modern "science"**, for example unlike other races about 90% of Asians have dry earwax. Similar absolutely measurable differences exist in height, body odor, alcohol and lactose tolerance, high altitude tolerance, vulnerability to specific diseases, hair structure, cold tolerance, risk of obesity, behavior (see e.g. the infamous *[chimp out](chimp_out.md)* behavior of black people) and others. While dryness of earwax is really a minor curiosity, it is completely unreasonable to believe that race differences stop at traits we humans find unimportant and that genetics somehow magically avoids affecting traits that are harder to measure and which our current society deems politically incorrect to exist. In fact differences in important areas such as intelligence were measured very well -- these are however either censored or declared incorrect and "debunked" by unquestionable "science" authorities, because politics.
Pseudoleft uses cheap, logically faulty arguments to deny the existence of race; for example that there are no clear objective boundaries between races -- of course there are not, but how does that imply nonexistence of race? That's like saying that color doesn't exist because given any two distinct colors there exists a gradual transition, or that [music](music.md) and noise are the same thing because objectively no clear line can be drawn between them.
Pseudoleft uses cheap, logically faulty arguments to deny the existence of race; for example that there are no clear objective boundaries between races -- of course there are not, but how does that imply nonexistence of race? The same argument could also be given even e.g. for the term *species* (see e.g. ring species in which the boundaries are not clear) so as to invalidate it; yet we see no one doubting the existence of various species of animals. That's like saying that color doesn't exist because given any two distinct colors there exists a gradual transition, or that [music](music.md) and noise are the same thing because objectively no clear line can be drawn between them.
The politically correct camp further argues that there wasn't enough time for human races to develop significant differences as evolution operates on scales of millions of years while the evolution of modern humans was taking part about in an order of magnitude smaller time scale. However it has been shown that **evolution can be extremely fast and make great changes in mere DECADES**, e.g. in cases of rapid environment change (shown e.g. in a documentary *Laws of the Lizard* on anoles that show signs of evolutionary change only after 14 years, also see e.g. the book *The 10,000 Year Explosion* talking about actual acceleration of human evolution) and interbreeding with other species (e.g. Neanderthals, which European population bred with but African population didn't), which did occur when humans spread around the world and had to live in vastly different conditions -- successful civilizations themselves actually furthermore started to rapidly change their environment to something that favors very different traits. It has for example been found that average male brain increased from 1372 gram in 1860 to 1424 grams in 1940, a very significant change in LESS THAN A CENTURY. We can take a look at the enormous differences between dog breeds which have been bred mostly during only the last 200 years and whose differences are enormous and not only physical, but also that of intelligence and temperament -- yes, the breeding of dogs has been selective, but a rapid change in environment may have a similar accelerating effect, and the process in humans still took many tens of thousands of years. For example races of slaves were probably selectively bred, even if unintentionally, as physically fit slaves were more likely to survive than those who were smart; similarly in prospering civilizations, e.g. that of Europe, where trade, business and development of technology (e.g. military) became more crucial for survival than in primitive desert or jungle civilizations, different traits such as intelligence became preferred by evolution.

@ -2,7 +2,7 @@
{ This is WIP, I use Vim but am not such guru really so there may appear some errors, I know this topic is pretty religious so don't eat me. ~drummyfish }
Vim (Vi Improved) is a legendary [free as in freedom](free_software.md), fairly (though not hardcore) [minimalist](minimalism.md) and [suckless](suckless.md) [terminal](terminal.md)-only (no [GUI](gui.md)) [text editor](text_editor.md) for skilled programmers and hackers, and one of the best editors you can choose for text editing and [programming](programming.md). It is a successor of a much simpler editor [vi](vi.md) that was made in 1976 and which has become a standard text editor installed on every [Unix](unix.md) system. Vim added features like tabs, [syntax highlight](syntax_highlight.md), [scriptability](script.md), sessions and plugins and as such has become not just a simple text editor but an editor that can comfortably be used for [programming](programming.md) instead of any bloated [IDE](ide.md). Observing a skilled Vim user edit text is really like watching a magician or a literal movie hacker -- the editing is extremely fast, without any use of mouse, it transcends mere text editing and for some becomes something akin a way of life.
Vim (Vi Improved) is a legendary [free as in freedom](free_software.md), fairly (though not hardcore) [minimalist](minimalism.md) and [suckless](suckless.md) [terminal](terminal.md)-only (no [GUI](gui.md)) [text editor](text_editor.md) for skilled programmers and hackers, and one of the best editors you can choose for text editing and [programming](programming.md). It is a successor of a much simpler editor [vi](vi.md) that was made in 1976 and which has become a standard text editor installed on every [Unix](unix.md) system. Vim added features like tabs, [syntax highlight](syntax_highlight.md), [scriptability](script.md), screen splitting, [unicode](unicode.md) support, sessions and [plugins](plugin.md) and as such has become not just a simple text editor but an editor that can comfortably be used for [programming](programming.md) instead of any bloated [IDE](ide.md). Observing a skilled Vim user edit text is really like watching a magician or a literal movie hacker -- the editing is extremely fast, without any use of mouse, it transcends mere text editing and for some becomes something akin a way of life.
Vim is generally known to be **"difficult to learn"** -- it is not because it is inherently difficult but rather for being very different from other editors -- it has no [GUI](gui.md) (even though it's still a screen-oriented [interactive](interactive.md) [TUI](tui.md)), it is keyboard-only and is operated via text commands rather than with a [mouse](mouse.md), it's also preferable to not even use arrow keys but rather [hjkl](hjkl.md) keys. There is even a [meme](meme.md) that says Vim is so difficult that just exiting it is a non-trivial task. People not acquainted with Vim aren't able to do it and if they accidentally open Vim they have to either Google how to close it or force kill the terminal [xD](xd.md) Of course it's not so difficult to do, it's a little bit different than in other software -- you have to press escape, then type `:q` and press enter (although depending on the situation this may not work, e.g. if you have multiple documents open and want to exit without saving you have to type `:wqa` etc.). The (sad) fact is that most [coding monkeys](coding.md) and "professional programmers" [nowadays](kids_these_days.md) choose some ugly [bloated](bloat.md) [IDE](ide.md) as their most important tool rather than investing two days into learning Vim, probably the best editor.
@ -68,6 +68,8 @@ syntax on
## Alternatives
*See also a nice big list at http://texteditors.org/cgi-bin/wiki.pl?ViFamily.*
Of course there are alternatives to Vim that are based on different paradigms, such as [Emacs](emacs.md), its biggest rival, or plan9 editors such as [Acme](acme.md). In this regard any [text editor](text_editor.md) is a potential alternative. Nevertheless people looking for Vim alternatives are usually looking for other vi-like editors. These are for example:
- **[vi](vi.md)**: While you probably won't use the original ancient vi program but rather something like [nvi](nvi.md), vi is a [POSIX](posix.md) standard for a text editor that's much simpler and universal than Vim. It lacks many features one may be used to from Vim such as tabs, [autocompletion](autocomplete.md), [syntax highligh](syntax_highlight.md) or multiple [undos](undo.mf). But limiting yourself to only using the features specified by the standard makes you more likely to be able to operate any vi-like text editor you encounter. (List of features added by Vim to vi can be found in `runtime/doc/vi_diff.txt` in Vim source tree.)

Loading…
Cancel
Save