Magic square by uru

var m:array[byte,byte]of word;b,i,j,k,n:word;begin
read(n);j:=n shr 1;repeat
inc(k);m[i,j]:=k;b:=ord(m[(i+2)mod n,(j+1)mod n]=0);i:=(i+b+1)mod n;j:=(j+b)mod n;until
k=n*n;for i:=0to n-1do for j:=1to n do
write(m[i,j-1]:4-1div j,^j:j div n)end.

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

download

return to the top page