Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/N-queens-problem/Logo/n-queens-problem.logo
Normal file
17
Task/N-queens-problem/Logo/n-queens-problem.logo
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue