From Esolang
Jump to navigation Jump to search

BackTurn is a 2D reversible programming language. There are three kinds: level 0, level 1, and level 2.


  • \ Fixed mirror*
  • / Fixed mirror*
  • [ Rotate counterclockwise and flip
  • ] Rotate clockwise and flip
  • + Input**
  • ? Output
  • ! Halt

(* = available only at level 1 or 2, not at level 0; ** = available only at level 2, not at level 0 or 1)

When the rotation is flip, then the entire group of rotators is flipped between clockwise and counterclockwise. The group consists of all rotators (regardless of direction) connected by a series of king moves.

Input: If hit moving right, is input one bit; if 0 then go up but if 1 then go down. If hit moving left just bounces back. If hit moving down then push back input 0 and go left. If hit moving up then push back input 1 and go left.

Output is a list of directions up/down/left/right; if the output is the reverse direction of the previous output then it cancels that previous output and now the one before that is considered as the last one so far in case that one will be cancelled too.

The program may begin at any exclamation mark and in any direction.

If the "unlimited memory" option is used, copies of the initial program can tile the infinite grid in order to make infinite memory. A program using this option may also have initialization of tiles; the initialization is done by initially flipping some rotator groups in some of the copies.


The flipping mirrors from BackFlip can be made from the following patterns of two rotators each:

 v^ v^
> [<] >
<] > [<
 ^v ^v
>[ < ]>
< ]>[ <
 v^ ^v

These patterns are for the / mirror (to make \ mirror, flip the rotators). Which one of these four patterns is needed to form it depends on what other mirrors are in the same row/column (the v^<> are just to explain which direction it is going) (which pattern makes a / mirror makes a \ mirror instead if the context is different).