Brainfuck++++++++++++++++++++

From Esolang
Jump to navigation Jump to search

brainfuck+++++++++++++++++++ (or just bf19) is a joke derivative of Brainfuck by CosmicMan08#1975 (User:CosmicMan08) meant to parody other brainfuck derivatives that just add a bunch of extra functions that could easily be recreated by brainfuck normally. The original BF19 adds 34 additional instructions (more instructions are in the extension BF69).

Instruction List

Instruction Meaning
> move pointer right
< move pointer left
{ remove the cell to the right and move all cells after it left
} remove the cell to the left and move all cells after it left
( add a new cell to the right and move all cells after it right
) add a new cell to the left and move all cells after it right
+ increment the value at the pointer
- decrease the value at the pointer
* multiply the value at the pointer by the value at the next cell
/ divide the value at the pointer by the value at the next cell
! if the value at the pointer is 0 then set it to 1, if it's 1 set it to 0, otherwise do nothing
. output the character represented by the ascii value at the pointer
, input a character and store it in the cell at the pointer
[ jump past the matching ] if the cell at the pointer is 0
] go back to the matching [ if the cell at the pointer isn't 0
\ escape out of the current loop/function
# skip the next instruction unless the value at the pointer and the value at the cell to the right are equal
? sets the cell at the pointer to a random number between 0-256
$ moves the pointer right half of the time and left half of the time
& skips the next instruction half of the time
@ terminate the program
" activate string mode if it is off, every character from here until the next " will be inserted into the cell at the pointer and cause the pointer to be moved right afterward
` perform a leftward bitshift operation on the current cell
~ perform a rightward bitshift operation on the current cell
| runs the entire program from the start all the way to where the instruction pointer is now
; prints the source code of the program
^ the first ^ will start a comment and the second ^ will end the comment
: copies the current cell's value into the cell to the right
' executes what the program has printed as code
_ temporarily disables any new commands (besides _) and turns the program into completely normal brainfuck until encountering another _
% every odd % skips to the next % unless the value at the pointer isn't 0, every even % skips back to the previous % unless the value at the pointer is 0
= redefines a function, example: a[-]a b[>]b a=b ^now a does the same thing as b^
0 every odd 0 moves the pointer to the next 0, every even 0 moves the pointer back to the previous 0
1 runs everything that has been printed so far as Unary code
2 copies every cell and pastes it after itself
3 clones every cell 3 times
4 every cell (that has been modified before) now has a 50% chance of having a random number from -5 to 5 added to it
5 rounds the current cell (1 --> 0 4 --> 5 12 --> 10)
6 every instruction from here on out (besides 9) will just print "Nice. "
7 makes the program read right-left instead of left-right (and vice-versa)
8 sets every cell in a 3 cell-wide radius of the pointer or 8
9 cancels out 6

Extra note - Any character that isn't recognized will act as a function, the first time it's used it will start to define a function, then ends the definition the next time it's used, any future uses of the character will call that function. example: F[-]F >F<F>++++++++++[<++++++++++>-]<---.

Brainfuck+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Brainfuck+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ (also known as bf69) is an update to Brainfuck+++++++++++++++++++ that adds 26 new instructions with features like unicode support, wait/sleep, multiverse timetravel, among more. This update brings the total amount of commands up to 69.

New Instructions

All of the new instructions are ones that are outside of the ascii character set.

Instruction Meaning
ñ output the character represented by the unicode value at the pointer
¡ unbounds the current cell, meaning that it won't underflow or overflow (and bounds the cell if the current cell is unbounded, if the current cell has an out of range value when bounded it will go to 0)
¿ moves the pointer to a random cell (that has been accessed before)
ó temporarily runs the program as befunge code until encountering another ó
modulo the value at the pointer by the value at the next cell
rewind the current tape back in time by 1 step
spawn a parallel timeline below the current timeline, with a copy of the tape and all pointers in it. this instruction pointer jumps to the matching ). spawn a new instruction pointer within the newly spawned timeline, beginning execution immediately after this instruction.
if this is executed outside of the main timeline, kill this timeline and all the memory/instruction pointers currently in it
move all memory pointers in this timeline to the same location in the next ("lower") parallel universe. if a lower timeline does not exist, these pointers are discarded instead.
move all memory pointers in this timeline to the same location in the next ("higher") parallel universe. if a higher timeline does not exist, these pointers are discarded instead.
if the next ("lower") parallel universe contains a nonzero amount of memory pointers, freeze this instruction pointer for this turn. if the next parallel universe has no memory pointers, or if this is the "lowest" timeline, do nothing and continue.
makes the current timeline wait 1 second
ß replaces the character in the program in the position = to the cell to the right by the ascii (or unicode if unbounded) character in the current cell
© jump past the matching ® if the cell at the pointer isn't 0
® go back to the matching © if the cell at the pointer is 0
skips the next instruction
performs a square root on the current cell
replaces the value in the current cell with a random number between the number in the left cell and the number in the right cell
π replaces the current cell with pi to the precision of what the cell used to equal (with the decimal point removed)
add the value at the next cell to the value at the pointer
subtract the value at the next cell from the value at the pointer
æ turns itself into the ascii (or unicode if unbounded) character at the pointer
± has a 50% chance to run + and a 50% chance to run -
the next instruction will now run twice, then run the instruction two places backwards, finally it will run the instruction at the very end of the program.
makes the program loop upon reaching the final instruction, until another ∞ has been reached
plays a note with the frequency of the cell on the pointer

Examples

Hello, World!

"!dlroW ,olleH"[<.]

Version without text reversing: 0@[<.]"Hello, World!"0# 7

Quine

Quines are trivial in BF19: ;

Self-Interpreter

A program that can interpret BF19 programs in BF19, once again it's basically trivial: ,[.,]'