N Queens by murky-satyr

N:=stdin nextByte- 49.{{}}do:(Q:=[:o|0to:N do:[:x|I:=-1.L:=o size.(o anySatisfy:[:v|x-(I:=I+1)+L=v|(x+I-L=v)|(x=v)])or:[L=N and:[o do:[:i|stdout<<i<<$ ].x printNl].{o,{x}}do:Q]]])

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

download

return to the top page