Brainwhirl
Jump to navigation
Jump to search
Brainwhirl is a BF derivative invented by User:Ttulka. It can be considered a turning tarpit, as its execution is based on spinning a wheel. In Brainwhirl, each instruction means "power" that rotates the wheel by a specific number of steps, relative to its current orientation. Like a standard wheel, it rotates clockwise, meaning that the following instruction is determined by moving backward.
The wheel's instructions follow the standard Brainfuck commands in this clockwise sequence: >
, <
, +
, -
, .
, ,
, [
, and ]
.
Brainwhirl only uses whole numbers from 0 to 7 as instructions, with no other symbols permitted.
Examples
Cat
BF: +[>,.<] BW: 6463132
Move value
BF: >>[-]<<[->>+<<] BW: 002346033306102
Hello, World!
BF: +[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<<-.>>>>+. BW: 643035560625000020266026004757400664040200424160005200610000073067400066
Brainwhirl to BF transpiler in JavaScript
const wheel = [">", "<", "+", "-", ".", ",", "[", "]"] let pc = 0 const bf = input.split("").map(i => { pc = (wheel.length + pc - i) % wheel.length return wheel[pc] }).join('')
The variable input
contains a string with Brainwhirl code.