Turing Machine by nn

a=[i=0]
System.in.eachLine{a[i++-1]=[0]*63+it.tokenize()}
b=[]
s="A"
for(l=i=114;s>"#";s=v[2]){v=a[b[i]?b[i]:0][(int)s]
b[i]=(int)v[0]-48
i+=v[1]>'<'?1:-1
i<l?l=i:0}
print b[l..-1].join()

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page