Dragon curve by hallvabo

d=H=N=2**input()+1
x=411718%(N+752)
W=-89139139%x
g=(~-W*[32]+[10])*H
for n in range(N):g[x]=42;d+=cmp((n&-n)*2&n,1);x+=(1,W,-1,-W)[d%4]
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