Bolgefuck
Bolgefuck is an esoteric programming language created by User:Hajunsheng in 2025. It is a cursed fusion of Brainfuck and the chaotic spirit of Malbolge, where each character in the source code is transformed through a series of mathematical rituals before being interpreted as a Brainfuck command.
Specification
Each character in the source is:
- Converted to its ASCII code.
- Mapped to a number from a fixed sequence of seemingly random integers.
- Transformed by the formula:
(((n + 400) * 2) / 3) % 10
, rounded to the nearest integer. - If the result is 0–7, it is mapped to a Brainfuck command:
* 0 =>
* 1 =<
* 2 =+
* 3 =-
* 4 =.
* 5 =.
(intentional duplicate) * 6 =,
* 7 =[
or]
depending on context
- If the result is 8 or 9, it is a no-op.
Example
Input:
Hello, world!
This is transformed into a Brainfuck program and executed.
Implementation
A JavaScript implementation is available:
function bolgefuck(input){ const memory = new Array(30000).fill(0) let ptr = 0 let output = "" const chaosSeq = [17, 42, 93, 58, 11, 76, 29, 64, 85, 33, 7, 99, 2, 50, 61] const bfCommands = ['>', '<', '+', '-', '.', '.', ',', '[', ']'] let bfCode = "" for (let char of input) { const ascii = char.charCodeAt(0) const chaosNum = chaosSeq[ascii % chaosSeq.length] const transformed = Math.round((((chaosNum+400)*2)/3)%10) if (transformed<=7) { bfCode += bfCommands[transformed] } } let pc = 0 const loopStack = [] while (pc < bfCode.length) { const cmd = bfCode[pc] switch (cmd) { case '>': ptr++ break case '<': ptr-- break case '+': memory[ptr] = (memory[ptr]+1) % 256 break case '-': memory[ptr] = (memory[ptr] + 255) % 256 break case '.': output += String.fromCharCode(memory[ptr]) break case '[': if (memory[ptr] === 0){ let open = 1 while (open > 0 && ++pc < bfCode.length) { if (bfCode[pc] === '[') open++; if (bfCode[pc] === ']') open--; } } else { loopStack.push(pc) } break case ']': if (memory[ptr] !== 0){ pc = loopStack[loopStack.length - 1] } else { loopStack.pop() } break } pc++ } return output }
Computational class
From the implementation, we see that the chaosSeq
array is ultimately the source of the indices into the brainfuck table. If we run the chaosSeq
array through the formula, we get the indices: [8, 5, 9, 5, 4, 7, 6, 9, 3, 9, 1, 3, 8, 0, 7]
Pruning the ones greater than seven and making it unique, we are left with: [5, 4, 7, 6, 3, 1, 0]
Lacking, notably, is 2, which corresponds to +, although - can be repeated 255 times for the same effect. More importantly, there is no way to include a closing bracket. This means that this brainfuck variant cannot perform loops. It is therefore total and finite state.