Langtons Ant by murky-satyr

M=([' ']*79+'\n')*80
a=d=3241
TreeSet x=[]
"$System.in".toLong().times{M[a]='  #'[c=M[a]<=>33];x<<(a+=[80,-1,-80,1][d=d-c&3])%80}
(M.sum()-~/\s*\n/).eachLine{println it[x]}

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

download

return to the top page