M×N-Dimensional Brainfuck

From Esolang
Jump to navigation Jump to search

M×N-Dimensional Brainfuck is a brainfuck derivative with an M-dimensional tape and an N-dimensional program.

The initial pointer direction is positive in the first dimension.

The initial program counter direction is positive in the first dimension.

Instructions

Instruction Description
> Move the pointer forward
< Rotate the pointer direction
+ Increment the memory cell at the pointer
- Decrement the memory cell at the pointer
. Write the character in the memory cell at the pointer
, Read a character and store it in the memory cell at the pointer
[ Rotate the program counter direction if the memory cell at the pointer contains zero
] Reverse rotate the program counter direction if the memory cell at the pointer contains a nonzero value

Rotating from moving positively/negatively in the nth dimension results in moving positively/negatively in the (n+1)th dimension. Rotating from moving positively/negatively in the Mth/Nth dimension results in moving negatively/positively in the first dimension.