Brainfuck+
Jump to navigation
Jump to search
Brainfuck+ is an improved version of brainfuck invented by User:None1. Unlike brainfuck, the name Brainfuck+ should always be capitalized no matter its position in a sentence.
Differences from brainfuck
The differences between Brainfuck+ and brainfuck is based on brainfuck's disadvantages:
- Brainfuck uses byte cells, which makes representing integers larger than 255 very hard (though it is possible). Thus, Brainfuck+ uses unsigned 64 bit integers for cells, that means integers from 0 to 18446744073709551615 can be represented directly.
- Arithmetic in brainfuck is very slow. For example, if you want to calculate 15*17 in brainfuck, executing at least 255 commands is inevitable. Thus, Brainfuck+ adds arithmetic commands:
a
,s
andm
to let the current cell add, subtract, multiply by the next cell respectively. - Addressing in brainfuck is also very slow. For example, if you want to move from the 1st cell to the 10000th cell, executing at least 9999 commands is inevitable. Thus, Brainfuck+ adds the
&
command that moves the pointer to the (x+1)-th cell where x is the current cell value. - Integer I/O in brainfuck is difficult. Thus, Brainfuck+ adds the command
;
and:
to do integer input and output.
Examples
A+B Problem
;>;<a:
Hello, World!
>++++++++++<[-]m+++++++m++.[-]+mm+.[-]+mm++++++++.[-]+mm++++++++.[-]+m+m+.[-]m++++m++++.[-]m+++m++.[-]m++++++++m+++++++.[-]+m+m+.[-]+m+m++++.[-]+mm++++++++.[-]+mm.[-]m+++m+++.