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.
Bifunge
- Not to be confused with Befunge, ifunge, nor Befunge/index.php.
Bifunge is a fungeoid invented by User:None1. As the name states, this esolang uses bits.
Memory
Bifunge uses a bit stack.
I/O buffer
In order to use bit I/O, Bifunge has input and output buffers. The input buffer is a big-endian byte. When it's exhausted, a new byte is read and put into the buffer. The output buffer is a big-endian byte, too. When It's full, a byte is printed and the buffer is cleared.
Commands
Every command in Bifunge is a 2x2 bit grid, so there are 16 commands. The playfield extends indefinitely on all directions.
The IP is initially on the first command in the program, and its initial direction is right.
Representation
In order to make programs more readable, implementations are allowed to use one character to represent one bit. Characters with odd ASCII values are treated as 1 while others are treated as 0.
Command list
We'll use abcd to represent the command:
ab cd
| Command | Meaning |
|---|---|
| 0000 | NOP |
| 0001 | Pop two bits, AND them, and push the result. |
| 0010 | Pop two bits, OR them, and push the result. |
| 0011 | Change IP direction to down. |
| 0100 | Pop two bits, XOR them, and push the result. |
| 0101 | Change IP direction to right. |
| 0110 | Pop a bit, if it's 1, change IP direction to left, otherwise right. |
| 0111 | Read a bit from the input buffer and push it. |
| 1000 | Pop a bit, NOT it, and push the result. |
| 1001 | Pop a bit, if it's 1, change IP direction to up, otherwise down. |
| 1010 | Change IP direction to left. |
| 1011 | Pop a bit, and output it to the output buffer. |
| 1100 | Change IP direction to up. |
| 1101 | Halt. |
| 1110 | Push a 0 bit onto stack. |
| 1111 | Push a 1 bit onto stack. |
Computational class
It's a push-down automaton.