ABCDirection

From Esolang
Jump to navigation Jump to search

ABCDirection is a 2 dimensional esolang by User:BoundedBeans.

Instructions

A Turn right.
B No-op.
C Execute a command depending on the direction.
  • right: Move pointer left.
  • left: Move pointer right and flip the bit.
  • up: If the value at the pointer is 1, turn left. Otherwise, go straight.
  • down: Output like in Boolfuck.
D Execute a command depending on the direction.
  • right: Enqueue the current cell into the queue.
  • left: Dequeue the current cell from the queue.
  • up: Input the current cell like in Boolfuck.
  • down: If the value at the pointer is 1, set direction to down. Otherwise, dequeue a value from the queue. If the front of the queue is 1 and the cell is 0, set direction to up. Otherwise, if the front of the queue and the cell are both zero, dequeue another value from the queue. If the value dequeued is 0, set direction to left. If the value dequeued is 1, set direction to right.

The pointer starts at the top left, and starts by going downwards.

Note there can be no spaces in the code, other than after a line with six consecutive D’s, B should be used instead.

After the file reader reads 6 consecutive D’s in one line of code, from left to right, it reads the rest of the line, then stops. If you need to use D six times in a row more than once on different lines horizontally, use B to separate it.

The file reader needs to be stopped like this (6 D’s are required). Since it has stopped reading the file, anything can be written afterwards. This is a comment mechanism.