Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,7 +1,7 @@
|
|||
result: new []
|
||||
result: []
|
||||
|
||||
queens: function [n, i, a, b, c][
|
||||
if? i < n [
|
||||
switch i < n [
|
||||
loop 1..n 'j [
|
||||
if all? @[
|
||||
not? contains? a j
|
||||
|
|
@ -11,8 +11,7 @@ queens: function [n, i, a, b, c][
|
|||
queens n, i+1, a ++ @[j], b ++ @[i+j], c ++ @[i-j]
|
||||
|
||||
]
|
||||
]
|
||||
else [
|
||||
][
|
||||
if n = size a ->
|
||||
'result ++ @[a]
|
||||
]
|
||||
|
|
@ -24,8 +23,8 @@ queens BoardSize, 0, [], [], []
|
|||
loop result 'solution [
|
||||
loop solution 'col [
|
||||
|
||||
line: new repeat "-" BoardSize
|
||||
line\[col-1]: `Q`
|
||||
line: repeat "-" BoardSize
|
||||
line\[col-1]: 'Q'
|
||||
print line
|
||||
]
|
||||
print ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue