UBX

From Esolang
Jump to navigation Jump to search
Not to be confused with Bx because they're completely different esolangs although invented by the same author.

UBX (Ultimate Brainfuck eXtension) is an esolang invented by User:None1. It is brainfuck but equipped with almost all the extensions mentioned in Brainfuck extensions (as of 2026/1/17 13:00 UTC).

Memory

There are two 2-dimensional tapes. Each tape is unbounded on 2 sides, and cells contain unbounded unsigned integers. Each tape has two pointers, one with ID 0 and the other with ID 1. It doesn't matter which pointer is initially used.

There's also an unbounded unsigned accumulator.

Addresses are defined like this:

0 1 5 6 ...
2 4 7 13 ...
3 8 12 ...
9 11 ...
10 ...

The first line stores the program's source code (as C-style string) while ther cells are zeros.

Memory is persistent, which means that after each command, a new snapshot of the memory is created. The ID of the initial memory is 0. The ID of a new snapshot is the ID of the last snapshot plus 1.

Programs

Programs are 2-dimensional.

Commands

Besides all the commands in brainfuck, UBX has these commands:

Caption text
Command Meaning
* Jump to the current cell-th command (0-indexed).
A,S,M,D,R Add/subtract/multiply/floor divide/modulus the accumulator by current cell.
~ Swap accumulator and current cell.
«,» Left/right shift the accumulator by current cell bits.
&,^,| Bitwise and/or/xor the accumulator by current cell.
n Bitwise invert current cell.
c Copy current cell to accumulator (paste can be done using ~ command)
C Clear current cell
u/U Push accumulator into stack/queue
o/O Pop stack/queue and store the popped value in accumulator
B/b Break/continue current loop
s Self-interpret the C-style string starting from current cell. Execution goes back to the original program after the subprogram is finished.
f"filename" Redirect I/O to file path filename
F Redirect I/O back to standard I/O
% Beep (440 Hz, 1s)
:,; Read/Write current cell as integer
$&,$^,$| Logical and/or/xor the accumulator by current cell.
$~ Logical not the accumulator by current cell.
? Switch to the other pointer on the same tape.
Switch to the pointer with the same ID as the current one, but which is located on the other tape.
Rotate the IP 90° counter-clockwise.
Rotate the IP 90° clockwise.
T Spawns a thread which executes the current cell-th (0-indexed) line of code.
N"a.b.c.d:e" Redirects I/O to a connection to given IP address and port (You can use F to switch back to standard I/O as well).
ñ NOP
h or null character or EOF Halt
r Let p be the pointer, set the accumulator to *(p+*p).
w Let p be the pointer, set *(p+*p) to the accmulator.
t Toggle step trace.
ş Read a C-style string starting from current pointer and each character is on the right of the previous one.
ü Move the pointer to the up
v Move the pointer to the down
Print a C-style string starting from current pointer and each character is on the right of the previous one.
Ü Time-travel to snapshot whose ID is equal to the current cell value.
💤 Sleep for current cell milliseconds (Pauses all threads).

Examples

Cheating Quine