Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -2,8 +2,8 @@ safe[q_List, n_] :=
|
|||
With[{l = Length@q},
|
||||
Length@Union@q == Length@Union[q + Range@l] ==
|
||||
Length@Union[q - Range@l] == l]
|
||||
nQueen[q_List:{}, n_] :=
|
||||
nQueen[q_List: {}, n_] :=
|
||||
If[safe[q, n],
|
||||
If[Length[q] == n, q,
|
||||
Cases[Flatten[{nQueen[Append[q, #], n]}, 2] & /@ Range[n],
|
||||
Except[{Null} | {}]]], Null]
|
||||
If[Length[q] == n, {q},
|
||||
Cases[nQueen[Append[q, #], n] & /@ Range[n],
|
||||
Except[{Null} | {}], {2}]], Null]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue