queen.fun 569 B

123456789101112131415161718
  1. #import std
  2. #import nat
  3. #comment -[
  4. solves the general case of the 8 queens problem;
  5. invoke as queens -n, where n is a digit > 3]-
  6. #executable <'par',''>
  7. #optimize+
  8. queens =
  9. %np+~command.options.&h.keyword.&iNC; -+
  10. ~&iNC+ file$[contents: --<''>+ %nLP*=]+ ~&rSSs+ nleq-<&l*rFlhthPXPSPS,
  11. ~&i&& ~&lNrNCXX; ~&rr->rl ^/~&l ~&lrrhrSiF4E?/~&rrlPlCrtPX @r ^|/~& ^|T\~& -+
  12. -<&l^|*DlrTS/~& ~&iiDlSzyCK9hlPNNXXtCS,
  13. ^jrX/~& @rZK20lrpblPOlrEkPK13lhPK2 ~&i&& nleq$-&lh+-,
  14. ^/~&NNXS+iota -<&l+ ~&plll2llr2lrPrNCCCCNXS*=irSxPSp+ ^H/block iota; *iiK0 ^/~& sum+-