#define D  define
#define   U undef
#define     n   #


#undef  __FILE__
  n U   __FILE__
  n D f __FILE__
  n D N endif
  n D p e(prg)
  n D   e(x)  #x
  n D q       #
  n D o E     #F
  n D E Q(
  n D G   x,y,z)
  n D H E   y,z)
  n D F       ,)
  n D g o else
  n D d o D
  n D u o U
  n D w E o F D
#ifdef      prg



#ifndef   tape
n include p
n ifndef  tape
n D       tape O
n endif
#endif
n D O Z(O,
n D I Z(I,
q D i     tape
n U O
n U I
n D O         ,)
n D I         ,)
q D v     tape
n U O
n U I
#undef    tape
  n U     tape
  q U     tape
#endif /* tape */


q  ifndef  P
q D H y ## z
#ifdef   prg
d c 0    & 0
d R i    W v
d   B           Initializing...
d   L    V   /* the turing    */
d   M    Y(O)/* state to      */
d S(x)   T(O,1, start       ##x)
#else
d c 0
#endif
q   D    P P
q        include f
q U Q
q   D    H H 
q   N
q U f
o        ifndef P
E   #    D H y ## z F 
d O 3
d I 3
d x 3
o        if c+2
E o F    include <stdio.h>


int main() {
  return 2+c|!
  printf
  (
    d y "\n"
    d z ".."
    d j " "
    d P "*"
    d k " "
    o if c
    w Y(Z) #Z
    "Un"
    "define"
    "d state "
    Y(B) y y
"Tape:"
    o elif !c
"Usage:"
    d M 0
    " prg=myprg.turing "
    d L ,
    d R ,
    "["
      "tape="
      "\""
      "O I O..."
      "\""
    "]"
    g
    "Final "
"tape:"
    o N
    u O
    u I
    d O "O"
    d I "I"
    g
    d j     _
    d z    ...
    d k     ~

/*StarBox*/
/*********/
     d P *
     d y *
   E E /,*) F 
         *
         * State: B
/*********/

    u O
    u I
    o N
    u x
    u a
    u c
    u B
    o   ifdef s
  d J s
  d A l
  d B m
  d C r
  d t K
  d a L
  d b M
  d c R
    g
  d J S
  d A L
  d B M
  d C R
  d T K
  d a l
  d b m
  d c r
    o N
      y


  /*Triangles*/
  d  V j j j j
  d W j j j j
  d X(G  y j
  d Z(G j y
  d Y(x) P
  y A B C
  u    X
  u   Y
  u  Z
  u V
  u W

  d X(G    y x
  d Z(G   x y
  d V z  O O
  d W O O z
  d Y(x) x
  y A B C
  u    X
  u   Y
  u  Z
  u V
  u W

  d  V k k k k
  d W k k k k
  d X(G  y k
  d Z(G k y
  d Y(x) P
  y A B C
  u    X
  u   Y
  u  Z
  u V
  u W
         y
        u j
       u   k
      u     z
     u       P
    u         y
   u           O
  /*EndOfTriang*/


               /* Rain  */
  o ifndef I  /*/*/ /*/*/
       /*/*/*/*/*/ /*/*/
  E E /*/*/*/*/*/,/) F 
  d   K(G  /*/*/     y
  o  if J(x)
  u   K
  d   K(G x
  w a X(J(x),A       F 
  u   K
  d   Z(G x
  d   W   O
  w b Y(C)
  d P C
  u   Z
  o U W


  d Z(G z ## y
  w c        C
  u          Z
  g               /* <- exit */
  u          K
  d X(G z ## y


  w a A
  u   X
  d   X(G x
  d V O
  w b Y(A)
  d P A
  u   X
  u   V
  d   K(G x
  w c Z(J(x),C F 
  u   K
  o   N
  u   a
  u   b
  o U c


  d X(G  J(_ ## x)
  d V    J(_O)
  d Z(G  J(_ ## x)
  d W    J(_O)
  d Y(x) J(_ ## x)


  o ifdef s
  u       t
  d   t(G z
  d j S(x)
  d k T

  g
  u T
d T(G z
  d j s(x)
  d k t
  o N
  u          tape
  o include  p
  u          tape
  d stop_O   x
  d stop_I   x
  w a(P)     O&I&x


  d O        0
  d I        0
  d x        0
  w c a(P)
  u          O
  u          I
  u          x
  d   left   0
  d   right  1
  w j k(P ## x)
  u   P
  u   left
  u   right
  u   stop_O
  u   stop_I


  u Y
  o U         X
  u V
  u Z
  o U         W
  u A
  u B
  o U         C
  u j
  u k
  w B         J   (.)
  u J
  u t
  o U         T


    /*Codeblk*/
    o  D   P  P
    o include f
    E n  U  Q F 
    E n D H H F 


              g
  );
}
w P           x
o N
o N
o U           f
u l
u L
o U           m
u M
u r
o U           R
u S
u s
o U           B
u a
u c
