There are a great number of esoteric programming languages in the world, and the most famous one is brainfuck. To make it sounds better, you also may call it BF or b*fuck, but the essence will stay the same – it is a brain fuck. Being extremely minimalistic and fully functional at the same time, BF was designed to puzzle, challenge and amuse its users.
How Programmers Have Fun
In 1992-1993 a Swiss physics student Urban Dominik Müller was trying to invent a fully functional programming language with the least possible compiler. That means, programs created usingin such language would require very little modification to become a code ready to be executed by a machine. When Müller had finally succeeded, the world got a programming language consisted of seven symbols with a compiler of 296 bytes (171 by now). Young developer called his newborn language brainfuck and put in its read-me- file the following words: “Who can program anything useful with it? :)”.
That was a challenge but also that was a joke. The only thing is that when other people make fun of programmers they show them as geeks unable to do anything in their everyday life without but following the algorithms they use for coding. But when programmers themselves have fun of make jokes of their colleagues, they invent a programming language where the only way to use algorithms is to invent them first. Such a joke by Urban Müller has become the most popular esoteric programming language ever.
Brainfuck: Hello, World!
The most amazing thing about brainfuck with its seven symbols (eight by now) is Turing completeness. In other words, anything computable can be computed with BF. It is like seven notes in music that allow recording all possible sound combinations.
To understand the brainfuck programming language, imagine an endless tape consisting of memory cells. The value of each cell is initially set to zero. To move across the tape and interact with cells, you use a data pointer, initially pointing at the cell n, and eight commands to work with. The commands are presented with the following symbols:
- > Moving to the right.
- < Moving to the left.
- + Increasing value by one byte.
- – Decreasing value by one byte.
- . Value output.
- , Value input.
- [ Moving past the matching ] if the byte under the pointer is zero.
- ] Moving back to the matching [ if the byte under the pointer is nonzero.
Look at the piece of the brainfuck code showing the traditional ‘Hello, world!’ message on your screen:
This cryptic language is really minimalistic and difficult to comprehend by humans. Moreover, each every more or less complex task requires a long sequence of commands and is very time-consuming to fulfill. At the same time, having enough memory and these eight commands in supply, it is possible to create any program you like.
Brainfuck: Anything Useful?
If you google “brainfuck practical use”, you will receive a dozen thousands of results claiming that it can hardly be put into service. Enthusiasts add that it may come handy for learning and for coding competitions. Brainfuck’s minimalism makes programming a tricky thing but also stimulates discovering new approaches to standard tasks. Brainfuck programming has been a challenge to a large number of ambitious programmers for the last 23 years already.
Also, a range of micro- and nano-computers can benefit from brainfuck’s small compiler. The point is that a compiler is used to interpret any command written in a programming languages into a machine code. This process requires various processor resources including memory. The brainfuck language is that close to a machine code that has a really tiny compiler. Thus, even minuscule devices may “afford” executing programs written in BF without wasting their precious resources.
Finally, due to its closeness to a machine code, BF has a huge potential in the field of artificial intelligence. Its simplicity allows creating programs able to learn, modify themselves, and produce new programs. This is already happening on the basis of genetic algorithms. Remember, the infinite monkey theory? It claims that one of an infinite number of monkeys is able to re-create a play by Shakespeare randomly typing sequences of symbols. In a similar way a program written in BF can produce a code typing “Hello, World!” in a response to a relevant task in less than half an hour of trying.
So, when next time you see ‘Hello’ from any device, think. It may be a real communication between you, initiated by a program expressing goodwill towards you.