Brain Online Visualizer does not perform any optimization on the interpreted code.
If you want to run it faster, please visit the Brain Compiler project: https://github.com/brain-labs/brain

Run Step

Output

Examples

- Pow

++++++++++ make number 10 at cell 0 >+*** make 10 to its cube # print out debug information Try it!

- If-Else

+++ make the value 3 at cell 0 [ start infinite loop ? if cell 0 greater than 0 break ! : else add 1 + ; ] # print out debug information with value 3 at cell 0 Try it!

- Fibonacci

+#>+# initialization [ >+* copy the value from cell 1 to cell 2 <<{>>+<<} sum the value at the cell 0 with the value at the cell 2 >># move to cell 2 and print it out ] Try it!

- Hell Box

[]><[][]><[][]><[][]><[][]><[][]><[][]><[][]><[][]><[][]><[] []>+>+>++>++<[>[->++++<<+++>]<<]>----.>->+.+++++++..+++.<+[] [ This is hellbox, a 104 command Hello World ] [ >+>+>++>++<[>[->++++<<+++>]<<]>----.>>+.+++++++..+++ ] [ .>.<<<+++++++++++++++.>>.+++.------.--------.>+.>++. ] [ -- Robert de Bath -- 2014 ] []>>.<<<+++++++++++++++.>>.+++.------.--------.>+.+>++.<<<[] []><[][]><[][]><[][]><[][]><[][]><[][]><[][]><[][]><[][]><[] Try it!

- Even or Odd

++ make number 2 at cell 0 >+++++ make the number to check if it is even or odd at cell 1 >++++++++++ make number 10 at cell 2 >+** make 10 square at cell 3 <[-] clear the cell 2 +* copy the number from cell 1 to cell 2 >* multiply the numbers at cell 3 and 2 <<% calc of the number at cell 1 mod 2 >>$ print out the value of the number at cell 3 >++++++++++ >+++*++. make number 32 at cell 5 and print it out ' ' <{>>+<<} copy the number 10 to the cell 6 >>>+**+++++. print out 'i' ++++++++++. print out 's' <<. print out ' ' <<<< ? check if the number at cell 1 is odd >>>>>>----. print out 'o' -----------. print out 'd' . print out 'd' : otherwise it is even >>>>>>>+* copy the number <<++++ make the number 14 at cell 6 {>>-<<}>>. subtract it from 115 and print out 'e' <+++. print out 'v' >. print out 'e' <--------. print out 'n' ; Try it!

Quick Reference

> increment the data pointer (to point to the next cell to the right).
< decrement the data pointer (to point to the next cell to the left).
+ increment (increase by one) the byte at the data pointer.
- decrement (decrease by one) the byte at the data pointer.
* multiply *ptr with *(ptr-1). Store result in *ptr // format: 2 3 *
/ divide *ptr with *(ptr-1). Store result in *ptr // format: 2 3 /
% divide *ptr with *(ptr-1). Store the remainder in *ptr // format: 2 3 %
. output the byte at the data pointer.
$ prints out the value at the data pointer divided by 100.
# prints out the current debug information.
, accept one byte of input, storing its value in the byte at the data pointer.
[ a.k.a (while loop).If the value at the data pointer is zero, then instead of moving the instruction pointer forward to the next command, jump it forward to the command after the matching ] command.
] jump to its correspondent [ .
{ a.k.a (for loop). Iterates 'value-at-the-data-pointer' times and needs to be closed with a matching } command. It does not decrease the value at the data pointer. It will only work for positive values greather than zero.
} jump to its correspondent { .
! a.k.a break. jumps to the end of a loop ([ ] or { }) .
? a.k.a if. if the value at the data pointer is zero, jumps to the block with : or ; and executes the commands one by one up to its correlative ;, otherwise, it executes the code until it finds a : or ;.
: a.k.a else. it works as an otherwise for ?.
; ends a ? or : statement.

More information on: https://github.com/brain-labs/brain