Ultimate bf instruction minimalization!
Ultimate BF instruction minimalization! or UBFIM is a BF derivative with only 3 instructions made by BF enthusiast User:Wh1teWolf December 12, 2009. It uses an infinite tape for storage, each cell restricted to a 1-bit value. The language is the successor of Minifuck which may have 3 or 4 instructions (the description is vague as to whether no-op characters are instructions). It also has a resemblance to iag which had similar motivations.
Specifications
This instruction is using one-based indexing
Commands
< = Move pointer one cell to the left. (If pointer is currently over the first bit, do nothing.) ( = Move to next bit and flip it, skip next instruction if zero. any other character = No-op instruction.
Programs written in UBFIM are contained within a single Brainfuck loop, so if at the end of the program the current bit is non-zero, go back to the start.
Memory mapping
- Cell 2 = Set to 1 to perform input/output. If all I/O bits are empty perform input, else do output. Afterwards I/O cell 2 is set back to zero.
- Cell 3 = Pointer is here on program start.
- Cell 4-11 = I/O bits
Examples
Infinite loop
This program with loop forever, since the bit under the pointer will always be 1. Noted that this will also flood the memory.
(
Cat
(<(< (<(<( (<(<( (<(<( (<(<( (<(<( (<(<( (<(<( Zero out the I/O bits, and maybe some more. This line is not necessary the first time the program is run. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< We move back many times just to make sure we have reached all the way to the first bit. ( now cell 2 is set to 1. That means I/O, and since the I/O bits is all zero it performs input. <( set cell 2 to 1 again and output the inputted value. (<( go to cell 3 without changing its value. Since this is the end of the program and the current bit is non-zero the program gets executed again.
See Also
- BF instruction minimalization - other attempts on minimalizing bf
- interpreter - interpreter in Basic
- Kak - similar language