1L_AOI

From Esolang
Jump to navigation Jump to search

1L_AOI is an esoteric programming language that was designed by Tslil Clingman in early 2008, who drew great inspiration from Angle of Incidence 1L, a proposal by Gregor Richards circa 2005 for a way to reduce 2L to one instruction while maintaining much of the visual feel of 2L. A fundamental issue was pointed out by Chris Pressey in early 2011 (see Passing by a + sign) and a new 1L_AOI_EU spec proposed. However, the author quickly realised that there was a more simple solution that lay in reworking the MP state-transition table. All should now be well.

Explanation

Many components of the language are similar to those in the other 1L_x languages. There is only one symbol: the + (plus) sign. The 'other' symbol is anything else, and always behaves as nop. There is a Command Pointer (CP) which moves through space, initially placed on the second line from the top, in the left-hand corner of the program, headed East. There is also Memory Pointer (MP) which moves along a tape, one cell at a time. Each cell can store up one byte of information and is initialised to zero. The MP is initially located on Cell #3.

As the Command Pointer moves through space, it will encounter + signs. Following the Angle of Incidence 1L framework and the merged 1L_AOI_EU spec, + serves as both the turn and the operator.

Passing through a + sign

If the CP passes directly through the +, a command will be executed. Precedence is given to passing through a plus sign over passing by one. Originally, 1L_AOI had problems relating to a North/South headed CP when the cell under the MP was 0 (see next section). However, merely revising the MP state-transition table seems to have rectified this issue. The following is the new table:

Direction Effect
Down Move MP Right
Up Increase MP Cell by one
Left Decrease MP Cell by one
Right Move MP Left

Passing by a + sign

If the CP passes directly by a + sign, it interacts in a manner akin to Black Box. In the original Angle of Incidence 1L proposal, a deflection always occurred in this case, with the angle of incidence during the deflection determining the command executed. However, in 1L_AOI, a deflection may or may not happen, depending solely on the contents of the cell under the MP. The original "1L_AOI" spec enforced a conditional turn that was the same for all approach directions, however this turned out to have problematic consequences in the case the CP traveling North or South and thus not being able to modify the cell under the MP and effectively ending the programme if the cell contained a zero. However, interleaving the MP and CP commands on travel the travel axes seems to resolve this issue, allowing deflections to still be determined solely by the contents of the cell under the MP.

Thus, if the CP passes by a + sign, the effect is determined as follows: If the cell under the MP is non-zero, the Command Pointer will turn away from the +, otherwise, it will proceed straight. (The + sign must be diagonally opposite the point at which the CP is required to turn.)

Examples

If the MP is non-zero and the following is reached (with the arrows and slashes indicating only the direction of travel of the CP):

     +
>

the effect would be:

     +
>>>>\
    v
    v

The following turns are valid:

         +      +       +
>>>>>>>>\        />>>>>\
<<<<<<<</   >>>>>/     \>>>>>>>
         +        +   +

Be wary of reflections, they will most likely be trouble, the following is an example:

      +
>>>>>>   This will cause the the Command Pointer to deflect ambiguously, but twice
      +  and thus reflect itself 180 degrees.

I/O

I/O is the same as 2L:

The two leftmost tape locations, called TL0 (Tape Location 0) and TL1 (Tape Location 1) respectively, are significant. TL1 doesn't actually hold a value, it merely causes an I/O operation if you attempt to increment or decrement it. If the value at TL0 is 0, and you attempt to change the value of TL1, a character will be read from input into TL0. If TL0 is not 0, and you attempt to change the value of TL1, a character will be outputted from the value of TL0.

However, in 1L_AOI, TL1 always has a non-zero value, which allows for a conditional turn to occur when the Memory Pointer is pointing to it.

Example: Output a "!" character. (This requires the 1L_AOI_EU extension)

    +
 ++

+      +

 +    +
      +
         +
      +

+        +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +


 +      +


 +  ++  +