esolang

Bruhfunk

Brainfuck where every number has to be spelled out of multiplications and subtractions from a scrambled table.

Nurdle, 2022 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: HELLO

The idea

Nurdle made Bruhfunk in 2022, after brainfuck, his own ABFC and Malbolge. It aims to be tedious rather than impossible. There is no + or -. Every letter stands for a number, and a lower case letter multiplies by it while an upper case one subtracts it. The letters wait in a queue, and a digit then applies the whole queue to something.

Read the story

The numbers follow the keyboard, more or less. w multiplies by 2 and W subtracts 6, q multiplies by 0 and Q subtracts minus 49. And the 13s, d and O, turn into a random number from 0 to 13 after their first use.

The machine

DigitApplies the queue to
0The pointer's position
2The value under the pointer
3The value under the pointer, without storing it, then jumps to the label with that number
4The mode
1Nothing; it marks a label

In mode 0 the pointer works on a tape of 65,536 cells. In mode 1 it works on the console, 1,024 cells that hold the input before the program starts and are printed when it ends. A value below 0 turns positive. The specification's two programs only work out if a multiplication already takes the value's size, so it does in this implementation.

Example

The first is HELLO.
Expected: cat

The first is HELLO. Q4 subtracts minus 49 from mode 0, and 49 wraps to mode 1, the console. Wyw2 turns 0 into minus 6, then 36, then 72, an H. QH0 moves the pointer from 0 to 49 and back to minus 1, which turns into 1. qQHe0 multiplies the position by 0 first, so it always lands on 3.

The second is the empty program. The input is already on the console, so it comes straight back.

Patterns it teaches

  • Hostile design: every number is a small puzzle in a table that follows the keyboard.

Further

Also in Hostile

Write your own in Run Convert a program from Bruhfunk

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: bruhfunk.

Command line

shib run bruhfunk -e 'Q4
Wyw2
QH0
Xe2
w0
Dr2
qQHe0
Dr2
qQHr0
YtW2'
shib manual bruhfunk

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/bruhfunk.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org