Emoticode
Emoticode is a bf derivative which uses Emoticons in place of the typical commands.
Emoticode also expands on brainfuck, making it less complex and more human write-able (though I can't guarantee you'll be able to read what you wrote)
Commands
This is every Emoticode core command mapped to Brainfuck. I recommend you visit brainfucks page if you don't already know how it works.
:D = > D: = < :) = + :( = - :P = . :() = , -_- = ] O_O = [
However, Emoticode isn't just reskinned Brainfuck, it also features:
Abstractions
Repeaters
If you don't want to write out :)
72 times to store H in the current cell, you can use this handy piece of syntax:
:N_[syntax]
. When N is a positive non-zero number it becomes the amount of repeats for the piece of code you attach. You should not put the syntax in brackets.
Example of using Repeaters to print "H":
:72_:) :P :D
You cannot attach multiple pieces of code to a repeater. It can only repeat 1 piece of other syntax.
Repeaters can repeat macro calls, though.
Macros
Macros are very useful for minifying if you keep doing the same piece of code over and over again.
To define a macro:
:O_[name]
. This is your opening piece of code. In actual code, the name does have to be in brackets.
:|
. This is your ending piece of code. This is how you close a macro once you've defined what it does
:>_[name]
. This is how you call a macro. Once you have a macro defined this is what you do to call it. The name still does have to be in brackets.
Example of using a Macro and Repeaters to print "H":
:O_[pm] :P :D :| :72_:) :>_[pm]
Strings
If you don't want to manually write an ASCII value into however many cells your output needs, you can use strings to write it quickly.
:S_"string"
is what you need to know. From the cell you're currently in, using :S will automatically overwrite the current cell and cells after it to write a phrase, while keeping you in the current cell. This does not move the pointer.
Example use strings to print "Hello, World!":
:S_"Hello, World!\n" O_O :P :D -_-
Miscellaneous
Flush
For performance, the interpreter will only call a text buffer flush on newline or at the end of the program (as a check to make sure nothing is un-printed). If you have a particularly long program that uses no newlines and need it to flush before the program is fully ran:
:F
will flush the text buffer when called, regardless of what's happening.
Quines
This piece of syntax exists solely to make Quines super easy:
:q
automatically writes every line of the source code of the current program to the tape from the cell its currently in. This one could be very destructive if done in cell 1 of a program with actual useful code as it overwrites anything in the cells it needs.
using :q
to make a quine:
:q O_O :P :D -_-
Samples
If you want to see more Emoticode programs such as Fizzbuzz or the Mandelbrot program printed as ASCII art you can visit the official Emoticode github pages samples folder.
Credits
- User:Myalt2334 for creating Emoticode
- @Zomis for creating the brainfuck Fizzbuzz program that Fizzbuzz.O_O is based off of
- Erik Bosman for creating the brainfuck Mandelbrot program that mandelbrot.O_O is based off of