2-ill

From Esolang
Jump to navigation Jump to search

2-ill is designed by User:Zzo38, to be something like 2L but a bit different.

The memory is a tape (similar to Brainfuck) infinite on both directions and starts all zero, each cell can be only value 0 or 1, no other values are possible.

The commands are:

  • $ indicates start position of program, going east. If hit, it has no effect.
  • @ turns program pointer clockwise if value at pointer is 1, or counter-clockwise if is 0.
  • # has different effects depending on direction of program pointer:
    • North = output bit at tape pointer, skip 2 program cells
    • South = input bit, store at tape pointer, skip 2 program cells
    • West = move tape pointer 1 space backwards, skip 2 program cells
    • East = toggle bit at tape pointer and then move tape pointer 1 space forwards, skip 2 program cells
  • Anything else does nothing and can be used for comments.

Program stops when program pointer falls off the edge of the world.

Examples

A bitwise cat program which records the inverse of each bit along the tape:

'------'
'@  @ @'
'   @@ '
'@#$ @ '
'   #  '
'      '
'  @ @ '
'  @@@ '
'@    @'
'------'

A plain old bitwise cat program:

@@@
@$@
 | 
 # 
 | 
@?@
@@@

Writes alternating 0's and 1's to the tape:

@       @

   @#   @
   @   #@
    @@
@$#  @
    @#  @

Idiom for ending up on a known cell (one left of the current cell, at label A) after writing an unknown value to the current cell:

      @@
     $ @
      #

       @@
A  #@#@ @
   @    @
   @@  @@

Implementations

2-ill is implemented in yoob.