N Queens by yshl

/f{dup length n eq{dup aload pop n 1 sub{=only( )print}repeat =}if 0 1 n 1
sub{1 true 3 index{3 index 2 copy ne 3 1 roll sub abs 3 index ne and and exch 1
add exch}forall{[2 index 4 index aload pop]f pop}if def}for}def/n .runstdin
def[]f

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

download

return to the top page