KonamiCode

From Esolang
Jump to navigation Jump to search
KonamiCode
Paradigm(s) imperative
Designed by User:GingerIndustries
Appeared in 2021
Memory system cell-based
Computational class Unknown
Reference implementation pynami
File extension(s) .kc

KonamiCode is an esoteric programming language that is designed to be similar to BrainFuck but slightly easier to use. Its name comes from its commands, all of which represent buttons on a game controller. (except for the parenthesis). This means that you can program in it using a game controller with a D-Pad, 4 buttons, and a Select and Start button.

Syntax

KonamiCode uses only 10 symbols (excluding comments, <<, and >>). It ignores text in comments, spaces, and linebreaks, but all other characters are illegal.

KonamiCode commands list
Symbol Description Usage
v(number)
Save the passed number to the currently selected memory address
v(^^^)
>(address)
Sets the currently selected memory address
>(^>)
<<
Outputs the value of the current address to the console (first converting it to ASCII)
<<
<<<
Outputs the value of the current address to the console (as a number)
<<<
>>
Gets a string of text from the console and saves it to memory, one character per address starting at the current address.
Note: Moves the address pointer to the end of the written memory. For example, if I inputted a 5-character string with the pointer at index 1, the pointer would end at index 6.
>>
L(id)
Used in conjunction with A and B
L(^^^)
A(id)
If the current address is equal to the value in the comparison buffer, go to the L symbol with a matching id and continue from there.
A(^^^)
B(id)
If the current address is not equal to the value in the comparison buffer, go to the L symbol with a matching id and continue from there.
B(^^^)
S(value)
Sets the value of the comparison buffer.
S(^^^)
( and )
Used to create numbers, se the Numbers section below.
(^^^)
[ and ]
Used to create comments.
[some text]

Numbers

Numbers are formatted as sets of bases seperated by the > symbol and enclosed by parenthesis. For example, 512 would be (^^^^^>^>^^). In this documentation, number, value, and address all refer to a number in this format.

Special numbers

Certain numbers have special uses when used with some statements. All special numbers are enclosed with a double parenthesis, i.e.

>((>))
Special numbers
Syntax Meaning
((>))
Increases the pertinent value by 1
((<))
Decreases the pertinent value by 1
((^))
Gets the value of the current address
((<))
Gets the value of the address pointer
((S))
Gets the value of the comparison buffer

Hello World

KonamiCode has two ways to write Hello World. The first one is to simply enter the Konami code:

^^vv<><>BALS

which will output "Hello World!" The other way to write hello world is with a program that looks a bit like this:

v(^^^^^^^>^^)<<v(^>>^)<<v(^>>^^^^^^^^)<<v(^>>^^^^^^^^)<<v(^>^>^)<<v(^^^>^^)<<v(^>^>^^^^^^^^^)<<v(^>^>^)<<v(^>^>^^^^)<<v(^>>^^^^^^^^)<<v(^>>)<<

A version with comments (on a seperate page for brevity)

Turing completeness

Using the below conversion table, BrainFuck programs can be converted to KonamiCode programs. Since BrainFuck is Turing complete, so is KonamiCode.

KonamiCode to BrainFuck
BF KC
> >((>))
< >((<))
+ v((>))
- v((<))
. <<
, >>
[ A and L (with S at 0)
] B and L (with S at 0)

Interpreters

A list of KonamiCode interpreters:

Interpreters
Name Language Features
pynami Python
  • Created by the author of KonamiCode
  • Comes with a REPL