We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Brainfart

From Esolang
Jump to navigation Jump to search

Brainfart is an esoteric programming language by User:Dragoneater67 in 2026. It was made to show that nondeterminism does not neccessarily prevent reversibility.

Overview

The program is a sequence of instructions. There is a weighted tree of unbounded signed integers. The tree is initially a single node that stores 0.

Brainfart instructions
Instruction Description
+ Increment the value of the current node.
- Decrement the value of the current node.
g If a child with the same value as the current node doesn't exist, graft a new child node with weight equal to 1 and value equal to the value of the current node, else, increment the weight of the child node with the same value as the current node.
v Travel to a random child node with randomness being biased towards higher weights, errors out when there are no children.
( Jump forward past matching ) if the current node's value is greater than 0, errors out if it's unmatched.
) Jump back past matching ( if the current node's value is greater than 0, errors out if it's unmatched.
/ Swap values with the parent node, NOP if the current node is the root node.