N Queens by pooq

dim b(7)
input""m
f()
sub f(n)local i
for i=0to m-1for j=0to n-1c=b(j):if(c=i)+(j-c=n-i)+(j+c=n+i)goto 1
next
b(n)=i
if n=m-1for k=0to m-1?b(k);next:?:break
f(n+1)
1next
end sub

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

download

return to the top page