Hq9eFuck
Brainfuck and HQ9+ in one language, with twice the memory and the answer to life, the universe and everything.
Egor Promyshlennikov, 2016 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Egor Promyshlennikov wrote Hq9eFuck in 2016, pronounced HugeFuck and also called H9F. It joins the eight commands of Brainfuck to the commands of HQ9+, the joke language whose H prints Hello World and whose 9 prints the whole of 99 bottles of beer. It is sold as a powerful modern language, and even the overview is a joke.
Read the story
Brainfuck has 30000 cells. Hq9eFuck says it moved to 32 bits and so has twice as many, 60000. One more command, DT, asks Deep Thought, the computer from The Hitchhiker's Guide to the Galaxy, for the answer to everything. The specification never writes the number, and this implementation prints 42.
Because Brainfuck is inside it, the language is Turing complete, and a loop can say Hello World as many times as a cell counts.
The machine
| Command | Does |
|---|---|
> < | Move the pointer |
+ - | Raise or lower the cell; + is also HQ9+'s accumulator |
[ ] | Loop while the cell is not 0 |
. , | Write or read a byte |
H | Print Hello, World! |
Q | Print the program |
9 | Print the 99 bottles of beer song |
DT | Print 42 |
The specification does not say whether H ends its line. This implementation does not, so 16 greetings come out as one long line.
Example
The program.
The program. It builds 16 in the second cell with a loop, then runs H and counts down 16 times.
Patterns it teaches
- Quine:
Qprints the program, soQon its own is a quine. - Turing completeness: the Brainfuck half alone is enough.
Further
See also
Hq9eFuck builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from Hq9eFuck
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: hq9efuck.
Command line
shib run hq9efuck -e 'H'shib manual hq9efuckSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/hq9efuck.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org