master
Miloslav Ciz 11 months ago
parent ecd9c2f991
commit 96776982b7

@ -4,8 +4,12 @@
4chan (https://4chan.org/) is the most famous [image board](image_board.md). As most image boards, 4chan has a nice, oldschool minimalist look, even though it contains shitty captchas for posting and the site's code is [proprietary](proprietary.md). The site tolerates a great amount of [free speech](free_speech.md) up to the point of being regularly labeled "right-wing extremist site" (although bans for stupid reasons such as harmless pedo jokes are very common, speaking from experience). Being a "rightist paradise" it is commonly seen as a rival to [reddit](reddit.md), aka the [pseudoleftist](pseudoleft.md) paradise -- both forums hate each other to death. The discussion style is pretty nice, there are many nice stories and memes (e.g. the famous [greentexts](greentext.md)) coming from 4chan but it can also be a hugely depressing place just due to the shear number of retards with incorrect opinions.
The site consists of multiple boards, each with given discussion topic and rules. The most (in)famous board is *random* AKA /b/ which is just a shitton of [meme](meme.md) shitposting, [porn](porn.md), [toxicity](toxic.md), [fun](fun.md), [trolling](troll.md) and retardedness.
The site consists of multiple boards, each with given discussion topic and rules. The most (in)famous boards are likely *politically incorrect* AKA /pol/, where most of the american school shooters hang around, and *random* AKA /b/ which is just a shitton of [meme](meme.md) shitposting, [porn](porn.md), [toxicity](toxic.md), [fun](fun.md), [trolling](troll.md) and retardedness.
For us the most important part of 4chan is the technology board known as /g/ (for technoloGEE). Browsing /g/ can bring all kinds of emotion, it's a place of relative freedom and somewhat beautiful chaos where all people from absolute retards to geniuses argue about important and unimportant things, brands, tech news and memes, and constantly advise each other to kill themselves. Sometimes the place is pretty toxic and not good for mental health, actually it is more of a rule than an exception.
As of 2022 /g/ became unreadable, ABANDON SHIP. The board became flooded with [capitalists](capitalism.md), cryptofascists, proprietary [shills](shill.md), [productivity](productivity_cult.md) freaks and other uber retards, it's really not worth reading anymore. You can still read good old threads on archives such as https://desuarchive.org/g/page/280004/.
As of 2022 /g/ became unreadable, ABANDON SHIP. The board became flooded with [capitalists](capitalism.md), cryptofascists, proprietary [shills](shill.md), [productivity](productivity_cult.md) freaks and other uber retards, it's really not worth reading anymore. You can still read good old threads on archives such as https://desuarchive.org/g/page/280004/.
## See Also
- [something awful](something_awful.md)

@ -1,6 +1,21 @@
# Bill Gate$
William "Bill" Gates (28.10.1955 -- TODO) is a [mass murderer and rapist](entrepreneur.md) (i.e. [capitalist](capitalism.md)) who established and led the terrorist organization [Micro$oft](microsoft.md). He is one of the most rich and evil individuals in history who took over the world by force establishing the [malware](malware.md) "[operating system](os.md)" [Window$](windows.md) as the common operating system, nowadays being dangerous especially by hiding behind his "charity organization" (see [charitywashing](charitywashing.md)) which has been widely criticized (see e.g. http://techrights.org/wiki/Gates_Foundation_Critique, even such mainstream media as [Wikipedia](wikipedia.md) present the criticism) but which nevertheless makes him look as someone doing "public good" in the eyes of the naive brainless [NPC](npc.md) masses.
William "Bill" Gaytes (28.10.1955 -- TODO) is a [mass murderer and rapist](entrepreneur.md) (i.e. [capitalist](capitalism.md)) who established and led the terrorist organization [Micro$oft](microsoft.md). He is one of the most rich and evil individuals in history who took over the world by force establishing the [malware](malware.md) "[operating system](os.md)" [Window$](windows.md) as the common operating system, nowadays being dangerous especially by hiding behind his "charity organization" (see [charitywashing](charitywashing.md)) which has been widely criticized (see e.g. http://techrights.org/wiki/Gates_Foundation_Critique, even such mainstream media as [Wikipedia](wikipedia.md) present the criticism) but which nevertheless makes him look as someone doing "public good" in the eyes of the naive brainless [NPC](npc.md) masses.
```
\__.,.
-." "./
/,/---"""\\
; __ __ ;
(=[0 ]"[ 0]=)
\| ""._,"" |/
| .___, |
\_, ._/
"---"
dead or alive
```
*ASCII portrait of Bill Gaytes*
He is really dumb, only speaks one language and didn't even finish university. He also has no moral values, but that goes without saying for any rich businessman. He was owned pretty hard in [chess](chess.md) by Magnus Carlsen on some shitty TV show.

@ -53,6 +53,7 @@ As anything can be represented with numbers, binary can be used to store any kin
## See Also
- [unary](unary.md)
- [ternary](ternary.md)
- [bit](bit.md)
- [hexadecimal](hexadeciaml.md)
- [De Morgan's laws](de_morgans_laws.md)

@ -43,10 +43,12 @@ Here is a list of notable computers.
| --------------------------------------- | ---- | ------------------------------------------------- | ------------------------------------------------- |
| [abacus](abacus.md) |-2500 | | one of the simplest digital counting tools |
| Antikythera mechanism | -125 | ~30 gears, largest with 223 teth | 1st known analog comp., by Greeks (mechanical) |
| [slide rule](slide_rule.md) | 1620 | | simple tool for multiplication and division |
| Shickard's calculating clock | 1623 | 17 wheels | 1st known calculator, could multiply, add and sub.|
| [Arithmometer](arithmometer.md) | 1820 | 6 digit numebrs | 1st commercial calculator (add, sub., mult.) |
| Difference Engine | 1822 | 8 digit numbers, 24 axles, 96 wheels | mech. digital comp. of polynomials, by Babbage |
| Analytical Engine design | 1837 | ~16K RAM, 40 digit numbers | 1st general purpose comp, not realized, by Babbage|
| [nomogram](nomogram.md) | 1884 | | graphical/geometrical tools aiding computation |
| [Z3](z3.md) | 1941 | 176B RAM, CPU 10Hz 22bit 2600 relays | 1st fully programmable electronic digital computer|
| [ENIAC](eniac.md) | 1945 | ~85B RAM, ~5KHz CPU, 18000 vaccum tubes | 1st general purpose computer |
| [PDP](pdp.md) 11 | 1970 | 4M RAM, CPU 1.25Mhz 16bit | legendary [mini](minicomputer.md) |

@ -1,6 +1,6 @@
# Future-Proof Technology
Future-proof technology is [technology](technology.md) that is very likely to stay functional for a very long time with minimal to no [maintenance](maintenance.md), even considering significant changes in state of technology in society. In a world of relatively complex technology, such as that of [computers](computer.md), this feature is generally pretty hard to achieve; today's [consumerist](consumerism.md) society makes the situation even much worse by focusing on immediate profit without long-term planning and by implementing things such as [bloat](bloat.md), intentional introduction of complexity and dependencies and [planned obsolescence](planned_obsolescence.md). But with good approach, such as that of [LRS](lrs.md), it is very possible to achieve.
Future-proof technology is [technology](technology.md) that is very likely to stay functional for a very long time with minimal to no [maintenance](maintenance.md), even considering significant changes in state of technology in society. In a world of relatively complex technology, such as that of [computers](computer.md), this feature is generally pretty hard to achieve; today's [consumerist](consumerism.md) society makes the situation even much worse by focusing on immediate profit without long-term planning and by implementing things such as [bloat](bloat.md), intentional introduction of complexity, [obscurity](obscurity.md), [dependencies](dependency.md) and [planned obsolescence](planned_obsolescence.md). But with good approach, such as that of [LRS](lrs.md), it is very possible to achieve.
A [truly good technology](lrs.md) is trying to be future-proof because this saves us the great cost of maintenance and reinventing wheels and it gives its users comfort and safety; users of future-proof technology know they can build upon it without fearing it will suddenly break.

@ -0,0 +1,36 @@
# Git
Git (name without any actual meaning) is a [FOSS](foss.md) ([GPL](gpl.md)) [version control system](vcs.md) (system for maintaining and collaboratively developing [source code](source_code.md) of programs), currently the most mainstream-popular one (surveys saying over 90% developers use it over other systems). Git is basically a [command line](cli.md) program allowing to submit and track changes of text files (usually source code in some [programming language](programming_language.md)), offering the possibility to switch between versions, [branches](fork.md), detect and resolve conflicts in collaborative editing etc.
Git was created by [Linus Torvalds](linus_torvalds.md) in 2005 to host the development of [Linux](linux.md) and to improve on systems such as [svn](svn.md). Since then it has become extremely popular, mainly thanks to [GitHub](github.md), a website that offered hosting of git projects along with "social network" features for the developers; after this similar hosting sites such as [GitLab](gitlab.md) and [Codeberg](codeberg.md) appeared, skyrocketing the popularity of git even more.
It is generally considered quite a good software, many praise its distributed nature, ability to work offline etc., however diehard software idealists still criticize its mildly [bloated](bloat.md) nature and also its usage complexity -- it is non-trivial to learn to work with git and many errors are infamously being resolved in a "trial/error + google" style, so some still try to improve on it by creating new systems.
**Is git literally [hitler](hitler.md)?** Well, by [suckless](suckless.md) standards git IS bloated and yes, git IS complicated as fuck, however let's try to go deeper and ask the important questions, namely "does this matter so much?" and "should I use git or avoid it like the devil?". The answer is actually this: it doesn't matter too much that git is bloated and you don't have to avoid using it. Why? Well, git is basically just a way of hosting, spreading and mirroring your source onto many git-hosting servers (i.e. you can't avoid using git if you want to spread your code to e.g. Codeberg and GitLab) AND at the same time git doesn't create a [dependency](dependency.md) for your project, i.e. its shittiness doesn't "infect" your project -- if git dies or if you simply want to start using something else, you just copy-paste your source code elsewhere, you put it on [FTP](ftp.md) or anything else, no problem. It's similar to how e.g. [Anarch](anarch.md) uses [SDL](sdl.md) (which is bloated as hell) to run on specific platforms -- if it doesn't hard-depend on SDL and doesn't get tied to it, it's OK (and actually unavoidable) to make use of it. You also don't even have to get into the complicated stuff about git (like merging branches and resolving conflicts) when you're simply committing to a simple one-man project.
**Which git hosting to use?** All of them (except for [GitHub](github.md) which is a proprietary terrorist site)! Do not fall into the trap of [githopping](githopping.md), just make tons of accounts, one on each git hosting site, add multiple push remotes and just keep pushing to all of them -- EZ. Remember, git hosting sites are just free file storage servers, not social platforms or brands to identify with. Do not use their non-git "features" such as issue trackers, CI and shit. They want you to use them as "facebook for programmers" and become dependent on their exclusive "features", so that's exactly what you want to avoid, just abuse their platform for free file storage.
## Alternatives
Here are some alternatives to git:
- **nothing**: If you don't have many people on the project, you can comfortably just use nothing, like in good [old](old.md) times. Share a directory with the source code and keep regular backups in separate directories, share the source online via [FTP](ftp.md) or something like that.
- **[svn](svn.md)**: The "main", older alternative to git, used e.g. by [SourceForge](sourceforge.md), apparently suffers from some design issues.
- **[mailing list](mailing_list.md)**: Development happens over email, people just keep sending [patches](patch.md) that are review and potentially merged by the maintainers to the main code base. This is how [Linux](linux.md) was developed before git.
- **[darcs](darcs.md)**: Alternative to git, written in [Haskell](haskell.md), advertising itself as simpler.
- **[lit](lit.md)** (previously known as *gut*): WIP [LRS](lrs.md)/[suckless](suckless.md) version control system.
- ...
## How To Use Git For Solo/Small Projects (Cheatsheet)
TODO
- `git add files_you_changed; git commit -m "Update"; git push`
- `git pull`
- `git stash`
- `git rm file_to_remove`
- `git init`
- `git log`
- `git diff`
- `git apply diff_file`
- *weird error*: just look it up on stack overflow

@ -23,4 +23,5 @@ Compared to [suckless](suckless.md), [unix philosophy](unix_philosophy.md) and [
- [minimalism](minimalism.md)
- [suckless](suckless.md)
- [KILL](kill.md)
- [kys](suicide.md)
- [LRS](lrs.md)

@ -2,7 +2,7 @@
Less retarded society (LRS, same [acronym](acronym.md) as [less retarded software](lrs.md)) is a model of ideal society towards which we, the [LRS](lrs.md), want to be moving. Less retarded society is a peaceful, collaborative society based on [love](love.md) of all [life](life.md), which aims for maximum well being of all living beings, a society without violence, [money](money.md), oppression, need for [work](work.md), social [competition](competition.md), poverty, scarcity, criminality, [censorship](censorship.md), [self-interest](self_interest.md), government, police, laws, bullshit, slavery and many other negative phenomena. It equally values all living beings and establishes true social equality in which everyone can pursue his true desires freely -- it is a TRULY [leftist](left_vs_right.md) society, not a [pseudoleftist](pseudoleft.md) one. The society works similarly to that described by the [Venus Project](venus_project.md) and various [anarchist](anarchism.md) theories (especially [anarcho pacifist](anpac.md) [communism](communism.md)).
**How is this different from other ideologies and "life philosophies"?** Well, one principal difference is that LRS doesn't want to [fight](fight_culture.md); nowadays as well as in the past society has always been about conflict, playing a **game** against others (nowadays e.g. market competition, employment competition, media competition, ...) in which some win, some can manage and some lose. Most political parties nowadays just want to change the rules of the game or downright switch to a different kind of game, some want to make the rules "more fair", or to make it favor their represented minority (so called [fascism](fascism.md)), some just want to [hack](hacking.md) the game, some want to [cheat](cheat.md) to win the game easily, some want to play fair but still win (i.e. become "successful"). LRS simply sees any kind of such game as unnecessary, cruel unethical and harmful in many ways not just to us, but to the whole planet. LRS therefore simply wants to stop the game, not by force but by making everyone see how bad the game is. It says that **competition and conflict must seize to be the basis of society**.
**How is this different from other ideologies and "life philosophies"?** Well, one principal difference is that LRS doesn't want to [fight](fight_culture.md); nowadays as well as in the past society has always been about conflict, playing a **game** against others (nowadays e.g. market competition, employment competition, media competition, ...) in which some win, some can manage and some lose. Most political parties nowadays just want to change the rules of the game or downright switch to a different kind of game, some want to make the rules "more fair", or to make it favor their represented minority (so called [fascism](fascism.md)), some just want to [hack](hacking.md) the game, some want to [cheat](cheat.md) to win the game easily, some want to play fair but still win (i.e. become "successful"). LRS simply sees any kind of such game as unnecessary, cruel, unethical and harmful in many ways not just to us, but to the whole planet. LRS therefore simply wants to stop the game, not by force but by making everyone see how bad the game is. It says that **competition and conflict must seize to be the basis of society**.
Note that this society is an ideal model, i.e. it can probably not be achieved 100% but it's something that gives us a direction and to which we can **get very close** with enough effort. We create an ideal theoretical model and then try to [approximate](approximation.md) it in reality, which is a [scientific](science.md) approach that is utilized almost everywhere: for example [mathematics](math.md) defines a perfect sphere and such a model is then useful in practice even if we cannot ever create a mathematically perfect sphere in the real physical world -- the mathematical equations of a sphere guide us so that with enough effort we are able to create physical spheres that are pretty close to an ideal sphere. The same can be done with society. This largely refutes the often given argument that *"it's impossible to achieve so we shouldn't try at all"* -- we should try our best and the closer to the ideal we get, the better for us.

@ -1,27 +1,150 @@
# Logic Circuit
Logic circuits are circuits made of [logic gates](logic_gate.md) that implement [Boolean functions](bool.md), i.e. they are "schematics to process 1s and 0s". They are used to design [computers](computer.md). Logic circuits are a bit similar to electronic circuits but are a level of [abstraction](abstraction.md) higher: they don't work with continuous [voltages](voltage.md) but rather with [discrete](discrete.md) [binary](binary.md) logic values: 1s and 0s. Logical circuits can be designed and simulated with specialized software and languages such as [VHDL](vhdl.md).
Logic circuits are circuits made of [logic gates](logic_gate.md) that implement [Boolean functions](bool.md), i.e. they are "schematics to process 1s and 0s". They are used to design [computers](computer.md) on a low level. Logic circuits are a bit similar to electronic circuits but are a level of [abstraction](abstraction.md) higher: they don't work with continuous [voltages](voltage.md) but rather with [discrete](discrete.md) [binary](binary.md) logic values: 1s and 0s. This allows us to make kind of "[portable](portable.md)" circuit descriptions independent of any specific [transistor](transistor.md) technology, or even of [electronics](electronics.md) itself (as logical circuit may in theory be realized even mechanically or in other similarly wild ways). Logical circuits can be designed and simulated with specialized software and languages such as [VHDL](vhdl.md).
Generally a logic circuit has *N* input bits and *M* output bits. Then we divide logic circuits into two main categories:
TODO: picture here
- **combinational**: The output values only depend on the input values, i.e. the circuit implements a pure mathematical [function](function.md). Behavior of such circuit can be described with a [truth table](truth_table.md), i.e. a table that for any combination of input values list their corresponding output.
- **sequential**: The output values generally depend on the input values and the internal state of the circuit, i.e. the circuit has a kind of [memory](memory.md) (it can be seen as a [finite state machine](finite_state_machine.md)). The internal state is normally implemented with so called [flip-flops](flip_flop.md) (logic gates that take as input their own output). Truth tables can't be used for describing these circuits. These circuits also often work with **[clock](clock.md)** synchronization, i.e. they have a specialized input called *clock* that periodically switches between 1 and 0 which drives the circuit's operation (this is where [overclocking](overclocking.md) comes from).
Generally a logic circuit can be seen as a "black box" that has *N* input bits and *M* output [bits](bit.md). Then we divide logic circuits into two main categories:
With logic circuits it is possible to implement any boolean function; [undecidability](undecidability.md) doesn't apply here as we're not dealing with [Turing machines](turing_machine.md) computations because the output always has a finite, fixed width, the computation can't end up in an infinite loop as there are no repeating steps, just a straightforward propagation of input values to the output. It is always possible to implement any function at least as a [look up table](lut.md) (which can be created with a [multiplexer](multiplexer.md)).
- **combinational**: The output values only depend on the input values, i.e. the circuit implements a pure mathematical [function](function.md). Behavior of such circuit can be described with a [truth table](truth_table.md), i.e. a table that for any combination of input values list their corresponding output. Examples of combinational circuits may be the very basic of logic circuits, the [AND](and.md) and [OR](or.md) functions.
- **sequential**: Extension of the former, here the output values generally depend on the input values AND additionally also on the internal [state](state.md) of the circuit, i.e. the circuit has a kind of [memory](memory.md) (it can be seen as a [finite state machine](finite_state_machine.md)). The internal state is normally implemented with so called [flip-flops](flip_flop.md) (logic gates that take as input their own output). Normal truth tables can't be used for describing these circuits (only if we include the internal state in them). These circuits also often work with **[clock](clock.md)** synchronization, i.e. they have a specialized input called *clock* that periodically switches between 1 and 0 which drives the circuit's operation (this is where [overclocking](overclocking.md) comes from).
Once we've designed a logic circuit, we can [optimize](optimization.md) it which usually means making it use fewer logic gates, i.e. make it cheaper to manufacture (but optimization can also aim for other things, e.g. shortening the maximum length from input to output, i.e. minimizing the circuit's [delay](delay.md)). The optimization can be done with a number of techniques such as manual simplification of the circuit's logic expression or with [Karnaugh maps](karnaugh_map.md).
Logical circuits can be drawn simply as "boxes", which one the base level are the basic logic gates such as [AND](and.md), [OR](or.md) etc., connected with lines. But as mentioned, their behavior can also be described with a truth table or a boolean expression, i.e. an algebraic expression that for each of the circuit outputs defines how it is computed from the outputs, for example *o = (x AND y) OR z* where *o* is the output and *x*, *y* and *z* are the inputs (each of which can have a value of either 1 or 0). Each of these types of representation has its potential advantages -- for example the graphical representation is a very human-friendly representation while the algebraic specification allows for optimization of the circuits using algebraic methods. Many hardware design languages therefore allow to use and combine different methods of describing logic circuits (some even offer more options such as describing the circuit behavior in a programming language such as [C](c.md)).
Some common logic circuits include:
With combinational logic circuits it is possible to implement any boolean function (i.e. "functions only with values 1 and 0"); [undecidability](undecidability.md) doesn't apply here as we're not dealing with [Turing machines](turing_machine.md) computations because the output always has a finite, fixed number of bits, the computation can't end up in an infinite loop as there are no repeating steps, just a straightforward propagation of input values to the output. It is always possible to implement any function at least as a [look up table](lut.md) (which can be created with a [multiplexer](multiplexer.md)). Sequential logic circuits on the other hand can be used to make the traditional computers that work in steps and can therefore get stuck in loop and so on.
Once we've designed a logic circuit, we can [optimize](optimization.md) it which usually means making it use fewer logic gates, i.e. make it cheaper to manufacture (but optimization can also aim for other things, e.g. shortening the maximum length from input to output, i.e. minimizing the circuit's [delay](delay.md)).
Some common logic circuits include (note that many of these can be implemented both as a combinational or sequential circuit):
- **[adder](adder.md)**: Performs addition. It has many parameters such as the bit width, optional carry output etc.
- **[multiplier](multiplier.md)**: Performs multiplication.
- **[multiplexer](multiplexer.md)** (mux): Has *M* address input bits plus another *2^M* data input bits. The output of the gate is the value of *N*th data bit where *N* is the number specified by the address input. I.e. the circuit selects one of its inputs and sends it to the output. This can be used to implement e.g. [memory](memory.md), [look up tables](lut.md), [bus](bus.md) arbiters and many more things.
- **[demultiplexer](demultiplexer.md)** (demux): Does the opposite of multiplexer, i.e. has one *M* address inputs and 1 data input and *2^M* outputs. Depending on the given address, the input is redirected to *N*th output (while other outputs are 0).
- **[RS](rs.md) flip-flop**: Possibly the simplest flip-flop (a sequential circuit) with two inputs, *R* (reset) and *S* (set), which can remember 1 bit of information (this bit can be set to 1 or 0 using the inputs). It can be implemented with two NOR gates.
- **[decoder](decoder.md)**: Has *M* inputs and *2^M* outputs. It sets *N*th output to 1 (others are 0) where *N* is the binary number on the input. I.e. decoder converts a binary number into one specific signal. It can be implemented as a demultiplexer whose data input is always 1.
- **[encoder](encoder.md)**: Does the opposite of encoder, i.e. has *2^M* inputs and *M* outputs, expects exactly one of the inputs to be 1 and the rest 0s, the output is a binary number representing the input that's 1.
- **[ALU](alu.md)** (arithmetic logic unit): A more complex circuit capable of performing a number of logic and arithmetic operations. It is a part of a [CPU](cpu.md).
- TODO: more
- ...
- TODO: flip-flops, more
## Minimization/Transformation Of Logic Circuits
Minimization (or optimization) is a crucial and **extremely important** part of designing logic circuits -- it means finding a logically equivalent circuit (i.e. one that behaves the same in regards to its [input/output](io.md), that is its truth table stays the same) that's smaller (composed of fewer gates); the motivation, of course, being saving resources (money, space, ...) and potentially even making the circuit faster. We may also potentially perform other transformations depending on what we need; for example we may wish to minimize the delay (longest path from input to output) or transform the circuit to only use [NAND](nand.md) gates (because some hardware manufacturing technologies greatly prefer NAND gates). All in all when designing a logic circuit, we basically always perform these two main steps:
1. Design the circuit to do what we want.
2. Minimize (and/or otherwise transform) it so as to [optimize](optimization.md) it.
Some basic methods of minimization include:
- **algebraic methods**: We use known logic formulas to simplify the logic expression representing our circuit. This is basically the same as simplifying fractions and similar mathematical expressions. Some common formulas we use:
- **De Morghan Laws**: TODO
- TODO ...
- **Karnaugh maps**: TODO
- **Quine McCluskey**: TODO
- ...
Example of minimization will follow in the example section.
## Example
TODO
One of the simplest logic circuits is the two-bit half adder which takes two input bits, *x* and *y*, and outputs their sum *s* and [carry over](carry.md) *c* (which will become important when chaining together more such adders). Let us write a truth table of this circuit (note that adding in [binary](binary.md) behaves basically the same as how we add by individual digits in decimal):
| x | y | s | c |
| --- | --- | --- | --- |
| 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Notice that this circuit is combinational -- its output (*s* and *c*) only depends on the input values *x* and *y* and nothing else, which is why we can write such a nice table.
OK, so now we have the circuit behavior specified by a truth table, let's continue by designing the actual circuit that implements this behavior. Let us start by writing a logic expression for each output (& = AND, | = OR, ! = NOT, ^ = XOR):
*s = x ^ y*
*c = x & y*
We see the expressions are quite simple, let us now draw the actual circuit made of the basic logic gates:
```
___
x --.------|XOR|--- s
\ .--|___|
\/
/\ ___
/ '--|AND|--- c
y --'------|___|
```
And that's it -- this circuit is so simple we can't simplify it further, so it's our actual result (as an exercise you may try to imagine we don't have a XOR gate available and try to replace it by AND, OR and NOT gates).
Next we can expand our half added to a full adder -- a full adder takes one more input *z*, which is a carry over from a previous adder and will be important when chaining adders together. Let's see the truth table of a full adder:
| x | y | z | s | c |
| --- | --- | --- | --- | --- |
| 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Let's try to make boolean expressions for both outputs now. We may notice *c* is 1 exactly when at least two of the inputs are 1, which we may write as
*c = (x & y) | (x & z) | (y & z)*
However, using the formula *(a & c) | (b & c) = (a ^ b) & c* , we can simplify (minimize) this to an expression that uses one fewer gate (notice there is one fewer operator)
*c = (x & y) | ((x ^ y) & z)*
The expression for *s* is not so clear though -- here we can use a method that always works: we simply look at all the lines in the truth table that result in *s = 1* and write them in "ORed" form as
*s = (x & !y & !z) | (!x & y & !z) | (!x & !y & z) | (x & y & z)*
Which we can also actually minimize (as an exercise try to figure out the formulas we used :p)
*s = ((x ^ y) & !z) | (!(x ^ y) & z)*
*s = (x ^ y) ^ z*
Now finally we can draw the full adder circuit
```
___
x ---.------|AND|--------------. ___
\ .---|___| ___ '--|OR |--- c
/ .----|AND|---|___|
y --.-' \ / .---|___|
\ \ ___ / /
\ '--|XOR|-'----.
'-----|___| / \ ___
/ '-|XOR|---------- s
z ----------------'---------|___|
```
Now let us spectacularly combine one half adder (HA) and three full adders (FA) into one magnificent 4 bit adder. It will be adding two 4bit numbers, *a* (composed of bits *a0* to *a3*) and *b* (composed of bits *b0* to *b3*). Also notice how the carry bits of lower adders are connected to carry inputs of the higher full adders -- this is the same principle we use when adding numbers manually with pen and paper. The resulting sum *s* is composed of bits *s0* to *s3*. Also keep in mind the circuit is still combinational, i.e. it has no memory, no clock input and adds the numbers in a "single run".
```
___
a3 -----|FA |-- c3
b3 -----| |------- s3
.--|___|
'--------.
___ | c2
a2 -----|FA |-'
b2 -----| |------- s2
.--|___|
'--------.
___ | c1
a1 -----|FA |-'
b1 -----| |------- s1
.--|___|
'--------.
___ | c0
a0 -----|HA |-'
b0 -----|___|------- s0
```

@ -36,13 +36,25 @@ The truth table of these gates is as follows:
---/__..-' ---/__..-' ---|_____.' ---|_____.'
OR NOR AND NAND
___ ___ . .
--\\ ''-. --\\ ''-. ---|'. ---|'.
)) )--- )) )O-- | >--- | >O--
--//__..-' --//__..-' ---|.' ---|.'
--\\ ''-. --\\ ''-. ---|'. |'.
)) )--- )) )O-- | >--- ---| >O--
--//__..-' --//__..-' ---|.' |.'
XOR XNOR ' BUFFER ' NOT
alternatively:
____ ____ ____ ____
---|=> 1| ---| & | ---|= 1 | | 1 |
| |--- | |--- | |--- ---| |o--
---|____| ---|____| ---|____| |____|
OR AND XOR NOT
or even:
___ ___ ___ ___
--|OR |-- --|AND|-- --|XOR|-- --|NOT|--
--|___| --|___| --|___| |___|
```
*Traditional symbols for logic gates.*
*symbols often used for logic gates*
Functions NAND and NOR are so called [functionally complete](functional_completeness.md) which means we can implement any other gate with only one of these gates. For example NOT(x) = NAND(x,x), AND(x,y) = NAND(NAND(x,y),NAND(x,y)), OR(x,y) = NAND(NAND(x,x),NAND(y,y)) etc. Similarly NOT(x) = NOR(x,x), OR(x,y) = NOR(NOR(x,y),NOR(x,y)) etc.

@ -14,7 +14,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
- **Optimize the [bottlenecks](bottleneck.md)!** Optimizing in the wrong place is a complete waste of time. If you're optimizing a part of code that's taking 1% of your program's run time, you will never speed up your program by more than that 1% even if you speed up the specific part by 10000%. Bottlenecks are usually inner-most loops of the main program loop, you can identify them with [profiling](profiling.md). Generally initialization code that runs only once in a long time doesn't need much optimization -- no one is going to care if a program starts up 1 millisecond faster (but of course in special cases such as launching many processes this may start to matter).
- **You can almost always trade space (memory usage) for time (CPU demand) and vice versa** and you can also fine-tune this. You typically gain speed by precomputation (look up tables, more demanding on memory) and memory with [compression](compression.md) (more demanding on CPU).
- **[Static](static.md) things are faster and smaller than [dynamic](dynamic.md) things.** This means that things that are somehow fixed/unchangeable are better in terms of performance (and usually also safer and better testable) than things that are allowed to change during [run time](runtime.md) -- for example calling a function directly (e.g. `myVar = myFunc();`) is both faster and requires fewer instructions than calling a function by pointer (e.g. `myVar = myFuncPointer();`): the latter is more flexible but for the price of performance, so if you don't need flexibility (dynamic behavior), use static behavior. This also applies to using [constants](constant.md) (faster/smaller) vs [variables](variable.md), static vs dynamic [typing](typing.md), normal vs dynamic [arrays](array.md) etc.
- **Be smart, use [math](math.md)**. Example: let's say you want to compute the radius of a zero-centered [bounding sphere](bounding_sphere.md) of an *N*-point [point cloud](point_cloud.md). Naively you might be computing the Euclidean distance (*sqrt(x^2 + y^2 + z^2)*) to each point and taking a maximum of them, however you can just find the maximum of squared distances (*x^2 + y^2 + z^2*) and return a square root of that maximum. This saves you a computation of *N - 1* square roots.
- **Be smart, use [math](math.md)**, for example simplify [expressions](expression.md) using known formulas, minimize [logic circuits](logic_circuit.md) etc. Example: let's say you want to compute the radius of a zero-centered [bounding sphere](bounding_sphere.md) of an *N*-point [point cloud](point_cloud.md). Naively you might be computing the Euclidean distance (*sqrt(x^2 + y^2 + z^2)*) to each point and taking a maximum of them, however you can just find the maximum of squared distances (*x^2 + y^2 + z^2*) and return a square root of that maximum. This saves you a computation of *N - 1* square roots.
- **Learn about [dynamic programming](dynamic_programming.md)**.
- **Avoid branches (ifs)** if you can (remember [ternary operators](ternary_operator.md), loop conditions etc. are branches as well). They break prediction in CPU pipelines and instruction preloading and are often source of great performance losses. Don't forget that you can many times compare and use the result of operations without using any branching (e.g. `x = (y == 5) + 1;` instead of `x = (y == 5) ? 2 : 1;`).
- **Use iteration instead of [recursion](recursion.md)** if possible (calling a function costs something).

@ -1,6 +1,6 @@
# Public Domain Computer
Public domain computer is yet nonexistent but planned and highly desired [simple](kiss.md) ethical [computer](computer.md) (in the common meaning of the word) whose specification is completely in the public domain and which is made with completely [selfless](selflessness.md) [LRS](lrs.md)-aligned goal of being absolutely non-malicious and maximally helpful to everyone. It should be the "people's computer", a simple, [suckless](suckless.md), user-respecting hackable computer offering maximum [freedom](free_software.md), a computer which anyone can study, improve, manufacture and repair without paying any "[intellectual property](intellectual_property.md)" fees, a computer which people can buy (well, while money still exist) for extremely low price and use for any purpose without being abused or oppressed.
Public domain computer is yet nonexistent but planned and highly desired [simple](kiss.md) ethical [computer](computer.md) (in the common meaning of the word) whose specification is completely in the [public domain](public_domain.md) and which is made with completely [selfless](selflessness.md) [LRS](lrs.md)-aligned goal of being absolutely non-malicious and maximally helpful to everyone. It should be the "people's computer", a simple, [suckless](suckless.md), user-respecting hackable computer offering maximum [freedom](free_software.md), a computer which anyone can study, improve, manufacture and repair without paying any "[intellectual property](intellectual_property.md)" fees, a computer which people can buy (well, while money still exist) for extremely low price and use for any purpose without being abused or oppressed.
The project is basically about asking: what if computers were designed to serve us instead of corporations? Imagine a computer that wouldn't stand in your way in whatever you want to do.

@ -8,9 +8,11 @@ The game builds on old ideas and mechanics but adds new weapons, mechanics, idea
Xonotic was forked from a game called [Nexuiz](nexuiz.md) after a [trademark](trademark.md) controversy (basically in 2010 the guy who started the project and abandoned it later, an ass called Lee Vermeulen, came back and secretly sold the trademark to some shit company named Illfonic). Nexuiz itself was created on top of liberated Quake 1 engine, so Xonotic still bears a lot Quake's legacy, however it masterfully expands on its core principles and makes the gameplay even better. For example rockets shot by rocket launcher can be guided with mouse while holding down the left button which adds a new skill element. New types of weapons were added to the classic AFPS weapons (e.g. the infamous electro, a [meme](meme.md) spamming weapon used by noobs for its forgiveness of lack of skill). Movement physics was also modified to give better air control and faster movement as a result.
Fun fact: Xonotic even briefly appeared on a TV show: https://yewtu.be/search/watch?v=a0TFejn95Sw.
The game's modified [Quake](quake.md) 1 (YES, 1) engine is called [Darkplaces](darkplaces.md). It can be highly customized and modded. Just like in other Quake engine games, there are many console commands (e.g. *cvars*) to alter almost anything about the game. Advanced programming can be done using [QuakeC](quakec.md). Maps can be created e.g. with [netradiant](netradiant.md).
Though compared to any mainstream [modern](modern.md) games Xonotic is quite nicely written (e.g. runs very fast, doesn't have billions of dependencies and despite not being 1.0 yet has fewer bugs than today's AAA games at release), from a more strict point of view it's still very bloated and it's known to contain some shitcode -- for example the engine has frame dependent physics (TODO: cite a specific line in code), uses [floating point](float.md) to represent time, great part of the game is written in a joke language called [QuakeC](quake_c.md), its net code is worse than e.g. that of OpenArena and some people complain about input lag and other bugs. It could definitely be written MUCH better, but as already mentioned it's still a million times better than any new game.
Though compared to any mainstream [modern](modern.md) games Xonotic is quite nicely written (e.g. runs very fast, doesn't have billions of [dependencies](dependency.md) and despite not being 1.0 yet has fewer bugs than today's AAA games at release), from a more strict point of view it's still very bloated and it's known to contain some shitcode -- for example the engine has frame dependent physics (TODO: cite a specific line in code), uses [floating point](float.md) to represent time, great part of the game is written in a joke language called [QuakeC](quake_c.md), its net code is worse than e.g. that of OpenArena and some people complain about input lag and other bugs. It could definitely be written MUCH better, but as already mentioned it's still a million times better than any new game.
{ The game runs extremely smooth for me even on old PC, I have no input lag. When my Internet connection gets bad I am sometimes unable to play Xonotic but still able to play OpenArena, which says something about the net code, but that happens very rarely. Also on pretty rare occasions I notice bugs such as imperfect culling of players or even projectiles just hanging mid air during whole game (which happens after heavy packet loss) etc., but nothing that would really be so frequent as to bother me. ~drummyfish }

Loading…
Cancel
Save