Magic square by Carlos Gutierrez

dim s(999)
input""n
q=n^2
p=int(n/2)+1
for i=1to q
o=p
s(o)=i
p=p+2*n
p=p-q*(p>q)
p=1+p-n*!mod(p,n)
if s(p)p=o+n
next
for i=1to q?s(i)using"###",chr$(32-22*!mod(i,n));next

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

download

return to the top page