to try :files :diag1 :diag2 :tried if :files = 0 [make "solutions :solutions+1 show :tried stop] localmake "safe (bitand :files :diag1 :diag2) until [:safe = 0] [ localmake "f bitnot bitand :safe minus :safe try bitand :files :f ashift bitand :diag1 :f -1 (ashift bitand :diag2 :f 1)+1 fput bitnot :f :tried localmake "safe bitand :safe :safe-1 ] end to queens :n make "solutions 0 try (lshift 1 :n)-1 -1 -1 [] output :solutions end print queens 8 ; 92