N Queens by shinh

N=gets.hex
def q a=[]
a[-N]?puts(a*' '):N.times{|i|z=a.size
a.all?{|x|x!=i&&(x-i).abs!=1+z-=1}&&q(a+[i])}end
q

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

download

return to the top page