Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/N-queens-problem/Quackery/n-queens-problem.quackery
Normal file
26
Task/N-queens-problem/Quackery/n-queens-problem.quackery
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[ false 0 rot
|
||||
witheach
|
||||
[ i + bit
|
||||
2dup & iff
|
||||
[ drop dip not
|
||||
conclude ]
|
||||
done
|
||||
| ]
|
||||
drop ] is l-bishop ( [ --> b )
|
||||
|
||||
[ reverse l-bishop ] is r-bishop ( [ --> b )
|
||||
|
||||
[ [] swap perms
|
||||
witheach
|
||||
[ dup l-bishop iff
|
||||
drop done
|
||||
dup r-bishop iff
|
||||
drop done
|
||||
nested join ] ] is queens ( n --> [ )
|
||||
|
||||
8 queens
|
||||
dup size echo say " solutions."
|
||||
cr cr
|
||||
witheach
|
||||
[ echo
|
||||
i^ 1+ 4 mod iff sp else cr ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue