Welcome to the Brain$!_* PLUS programming language tutorial! Brain$!_* PLUS is an esoteric programming language designed to be minimalistic and challenging. It operates on a simple memory model with a pointer and a set of commands.
To write Brain$!_* PLUS programs, you only need a few commands:
+
: Increment the value at the current memory cell.-
: Decrement the value at the current memory cell.>
: Move the pointer to the right.<
: Move the pointer to the left.[
: Jump forward to the command after the matching ]
if the value at the current memory cell is 0.]
: Jump back to the command after the matching [
if the value at the current memory cell is nonzero..
: Output the ASCII character of the value at the current memory cell.,
: Read a single character of input and store its ASCII value in the current memory cell.!
: Clears all the memory cells./
: Divides current memory cell with the next one.^
: Squares the current memory cell. (x^2)A{Code}
: Functions in Brainf@)$, it can be assigned to any letter A-Z, a-z. Any code can be put in it, but you cant define functions but you can use functions.#
: Copy the value of current cell$
: Paste the copiued value into the current cell=A
: Sets the value of the current cell to the character code next to the commandIncrement the current memory cell value by 5:
+++++
Explanation: The +
command increases the value at the current memory cell by 1. In this example, it's done five times, so the cell ends up with a value of 5.
Decrement the current memory cell value by 2:
--
Explanation: The -
command decreases the value at the current memory cell by 1. In this example, it's done twice, resulting in a value of -2.
Here's a more intricate example:
+++>++<-
Explanation: Here it starts getting interesting. <
and >
introduce multiple cells, with the command moving to a different cell. The code adds 3 to cell 1, moves to cell 2, adds 2 to cell 2, goes back to cell 1, and subtracts 1. The memory ends up being 2;2, showcasing how <
and >
control the movement between cells.
Read input, increment the value, and output the result:
,+.
Explanation: This code introduces ,
and .
commands. The , takes a input (number only) so you can input 6 and the current cell gets set to 6. the + increases 6 to 7, and the .
outputs the ASCII be version of the cell, 49 is 1, 65 is A and so on.
Division:
++++++>+++
Explanation: The code sets cell 1 to 6 and cell 2 to 3, goes back to cell 1 and divides cell 1 by cell 2 (6/3), causing cell 1 to be set to 2
Power:
+++^^
Explanation: The code sets cell 1 to 3 cubed (3^3)
A simple function code:
A{+++} B{AA} A>B
Explanation:This code creates functions called A and B, running A adds 3 to cell, B runs A twice.
Let's create a loop to multiply the current memory cell value by 3 and output:
+[->+++<]
Explanation: In this example, we're using a loop structure to multiply the value at the current memory cell by 3. The + at the start is the input, The loop [ ... ]
runs while the value in the current cell is not zero. The +
command increments the value, the -
command decrements a temporary cell. We get the multiplied value in memory cell 2.
After this point, the code gets extremly complicated and confusing:
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.
Explanation: In the code, 9 gets added to cell 2 and multiplied by 8 in cell 8. Achieving 72 which is "H" in ascii. 7 gets added to cell 2 and multiplied by 4, adding to cell 1, getting 101 in memory and printing "e". 101+7 gets "l" which gets printed twice, and finally 108+3 gets "o". finally getting "Hello" in output.
This code is really complicated, good luck figuring this one out:
++[->+>+<<]>>[-<<+>>]<<[>[->+>+<<]>>[-<<+>>]<<<-]
Explanation: This Brainf@*% code utilizes nested loops and pointer movements to square the value in the current memory cell. Let's break it down:
++
: This is like the input number, in this example we have 2 which is the number we will square[->+>+<<]
: The start of the loop moves the input number into cell 2 and 3.>>
: Move to the third cell.[-<<+>>]
: Moves cell 3 to cell 1.<<[>[->+>+<<]>>[-<<+>>]<<<-]
: The loop starts at the first cell, goes to cell 2 and duplicates to cell 3 and 4, and moves cell 4 back to cell 2, This complex arrangement of loops and pointer movements effectively squares the value in the current memory cell. The final squared result will be in the original cell.
Here's a Brain$!_* PLUS program that outputs "Hello, World!":
++++++++++[>++++++++>+++++++++++>+++++<<<-]>.>++.+++++++..+++.>-.------------.<++++++++.--------.+++.------.--------.>+.
Feel free to explore and experiment with different Brain$!_* PLUS programs. The language's simplicity makes it a fun challenge for programming enthusiasts.
A
: 65B
: 66C
: 67D
: 68E
: 69F
: 70G
: 71H
: 72I
: 73J
: 74K
: 75L
: 76M
: 77N
: 78O
: 79P
: 80Q
: 81R
: 82S
: 83T
: 84U
: 85V
: 86W
: 87X
: 88Y
: 89Z
: 90a
: 97b
: 98c
: 99d
: 100e
: 101f
: 102g
: 103h
: 104i
: 105j
: 106k
: 107l
: 108m
: 109n
: 110o
: 111p
: 112q
: 113r
: 114s
: 115t
: 116u
: 117v
: 118w
: 119x
: 120y
: 121z
: 122Use the Brain$!_* PLUS to run and test your Brain$!_* PLUS programs. Enter your code, provide input, and see the output. Have fun coding!
Try the Brain$!_* PLUS.
For more information and advanced topics, refer to the official Brain$!_* PLUS documentation.
++++++[->+++++++++++<]>.[-]<++++++[->+++++++++++++++++++<]>.[-]++++++++[->++++++++++++<]>+.[-]<+++++++[->+++++++++++++++<]>.[-]<++++++++++[->+++++++++++<]>.[-]<+++++++[->++++++++++<]>.[-]+++++++++[->+++++++++++++<]>.[-]+++++++++[->+++++++++++<]>.[-]<+++++++[->+++++++++++++++<]>++.[-]
+++++++[->+++++++++++<]>.[-]<
++++++++[->++++++++++++<]>+.[-]<
++++++++++[->++++++++++<]>.[-]<
+++++++[->+++++++++++<]>.[-]<
++++++++[->++++++++++++<]>+.[-]<
++++++++++[->+++++++++++<]>.[-]<
+++++++[->++++++++++++<]>.[-]<
++++++++++[->+++++++++++<]>+.[-]<
+++++++++++++++++++++++[->+++++<]>.[-]<
+++++++++++++++++++++++[->+++++<]>.[-]<