KonamiCode
Brainfuck for a game controller. Every command is a button, and the numbers are pressed out digit by digit.
GingerIndustries, 2021 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
GingerIndustries made KonamiCode in 2021, to be like brainfuck but a little easier to use. Its commands stand for the buttons of a controller with a D-pad, four buttons, Select and Start, so a program could be typed on a game pad. The name is the famous cheat code, and typing that code, ^^vv<><>BALS, is a whole program of its own. It prints Hello World!.
Read the story
Numbers are written one decimal digit at a time, each digit as that many ^, with > between them. So 72 is (^^^^^^^>^^) and 100 is (^>>), where an empty digit is a 0.
The machine
| Command | Does |
|---|---|
v(n) | Set the current cell to n |
>(n) | Go to address n |
<< <<< | Print the cell as a character, or as a number |
>> | Read a line into the cells from here on, and move past it |
S(n) | Set the comparison buffer |
L(id) | A label |
A(id) B(id) | Jump to the label if the cell equals the buffer, or if it does not |
[text] | A comment |
Four special numbers make it brainfuck. ((>)) and ((<)) add 1 to or take 1 from whatever the command sets, ((^)) is the current cell and ((S)) is the buffer. So v((>)) is brainfuck's + and >((<)) is its <. A loop is an A and an L at its start and a B and an L at its end, with the buffer at 0.
Example
The second is another way to write it.
The second is another way to write it. It sets one cell to each character code in turn and prints it, eleven times. Its w is 119, a small one, and it has no !.
This one reads a line, goes back to address 0 and prints cells until it finds a 0. The loop is brainfuck's [.>] in buttons.
Patterns it teaches
- Turing tarpit: every brainfuck command becomes one of its own.
- Encoding tricks: decimal digits in unary.
Further
- esolangs.org/wiki/KonamiCode
- brainfuck, which it follows.
See also
KonamiCode builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from KonamiCode
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: konamicode.
Command line
shib run konamicode -e '^^vv<><>BALS'shib manual konamicodeSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/konamicode.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org