N Queens by leonid

M=*0..id%9
def f*r
puts r*" "if[]==(M-r).map{|a|z=0;f *r+[a]if r.map{(a-r[-z+=1]).abs!=z}.all?}end
f

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

download

return to the top page