Brainfact

From Esolang
Jump to: navigation, search

This language is similar to Brainfuck, but with a twist. This language was created by User:Poolala.

If you put >'s, <'s, +'s or -'s in a row, the interpreter counts how many there are next to each other, calculates the factorial of that number, and runs the operation that number of times.

i.e. >>>> would move right 24 times, since the factorial of 4 is 24.

Also, loops are removed and replaced with a goto operation, (@) which takes the current cell, gets the factorial of the cell, and jumps to that character in the source.

i.e. +++@(...) would jump to the 720th character.

This twist makes it (more) difficult to program in this language.

Other than loops being replaced by a goto operation, this language has the exact same instruction set as brainfuck.

Turing completeness

This language is probably Turing complete, as you could move once, add once, move once, add once, so the factorials don't mess things up, although it would be difficult to make a loop this way.

Interpreter notes

Each cell must hold a bignum value, so the factorials don't cause an overflow. Any character that isn't a defined operation is a no-op.