Langtons Ant by hallvabo

n=input()
H=d=70
W=n%426/7-4
x=639472%(n+2)
g=(~-W*[32]+[10])*H
while n:d+=g[x]%5-1;g[x]^=3;x+=(1,W,-1,-W)[d%4];n-=1
print"%c"*W*H%tuple(g)

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

download

return to the top page