User:Outslider/langton language

This is the placeholder for description of langton language which uses Langton ant's behavior as a base for the processing.

To describe the idea of the Langton language is important to understand first, how the interpreter looks like. And it looks like this:

i                      <- input 0 1 1 0 1 0 1 0     --. 0 1 0 1 1 0 1 0        | 1 1 0 0 1 0 1 1        | 0 0 0 1 0 1 0 0         >  interpreting area 1 0 1 0 1 0 0 1       | 0 0 1 1 0 1 0 1        | 0 0 1 0 1 0 1 0      --' o       r     f ↑      ↑     ↑ |       |     | |       |     | out    out   flush &     & wait   run

Size of the interpreting area and positions of i, o, r and f might vary depending on the source code. This will be discussed further.

Once the program is started a first bit from the standard input goes down into the interpreting area from the i field. The bit becames Langton's Ant (with a little modified algorithm). That means:


 * bit has it's direction (at start this is down)
 * when bit enters on the field with the same boolean value, which its own it turns clockwise (from down to left, from left to up and so on)
 * when bit enters on the field with different value than its own it turns counter-clockwise
 * bit moves in its direction

Additional rules cause information processing and transfer through interpreting area:


 * when bit leaves the field this field changes the value (0→1, 1→0)
 * when bit goes behind right or left border of the interpreting area it appears on the oposite site an its value is changed (0→1, 1→0)
 * bit can't go behind top or bottom border - such request is ignored
 * bit can leave interpreting area at the bottom to one of the fields: o, r, f
 * if bit enters o field then bit's value is sent to the std output and new input bit can enter the interpreting area from i; program waits untill new input bit goes into
 * if bit enters r field then bit's value is sent to the std output and 0 value is automagically introduced into interpreting area as an input (input is NOT readed from stdin!).
 * if bit enters r field then nothing is posted to stdin and 0 value is automagically introduced into interpreting area as an input (input is NOT readed from stdin!).