Langtons Ant by rst76

main=do x<-readLn;mapM(putStrLn.map("  #"!!))$[16?11$9,45?29$22,9?3$4]!!mod(x+1)11!!x
w?x=f([1..67]>>[[1..w]>>[0]],0,1)x
f(s,a,b)x y=(\i->s:f(s%x$s!!x%y$1-i,-i*b,i*a)(x+i*b)(y-i*a))$s!!x!!y-1
(x%i)y=take i x++y:drop(i+1)x

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

download

return to the top page