Beetle

From Esolang
Jump to navigation Jump to search

Beetle is an esoteric programming language with a 2-dimensional array of cells inspired by Langton's Ant. It was created by k with the goal of being at least somewhat original.

Requirements

Each cell can be in 1 of 2 states : on or off. Beetle also has 2 external 8-bit variables that acts as input and outputs queues.

Commands

Beetle has the following commands :

Commands
Symbol Description
> Moves the pointer (beetle) right by one and swap the cell it lands on.
v Moves the pointer (beetle) down by one and swap the cell it lands on.
^ Moves the pointer (beetle) up by one and swap the cell it lands on.
< Moves the pointer (beetle) left by one and swap the cell it lands on.
{ If the current cell the beetle is sitting on is off, skip every instruction until corresponding '}'.
} Acts as a marker for the corresponding '{'.
@ Flips the direction the program is currently being run.
] Prevents the next instruction from being ran if the program pointer is going right.
[ Prevents the next instruction from being ran if the program pointer is going left.
, Breaks from the current loop.
. Restarts the current loop.
( Starts an unconditional brainfuck-style loop.
) Marks the end of a loop.
' Gets user input and deposits it into the input queue.
\ Allows the next bit from the input queue into the current cell.
/ Deposits the current bit at the end of the output queue.
| Outputs the output queue and clears it.

Examples

NAND Gate

><{>><{^/|>><<}}

'Hello, World!' Program using 2 cells of memory

{><}/{><}></{><}/{><}/{><}></{><}/{><}/{><}/|{><}/{><}></{><}></{><}/{><}/{><}></{><}/{><}></|{><}/{><}></{><}></{><}/{><}></{><}></{><}/{><}/|{><}/{><}></{><}></{><}/{><}></{><}></{><}/{><}/|{><}/{><}></{><}></{><}/{><}></{><}></{><}></{><}></|{><}/{><}></{><}/{><}></{><}></{><}/{><}/|{><}></{><}/{><}/{><}/{><}/{><}/|{><}/{><}></{><}/{><}></{><}/{><}></{><}></{><}></|{><}/{><}></{><}></{><}/{><}></{><}></{><}></{><}></|{><}/{><}></{><}></{><}></{><}/{><}/{><}></{><}/|{><}/{><}></{><}></{><}/{><}></{><}></{><}/{><}/|{><}/{><}></{><}></{><}/{><}/{><}></{><}/{><}/|{><}/{><}></{><}/{><}/{><}/{><}/{><}></|