Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
|
|
@ -5,7 +5,7 @@ IN: queens
|
|||
|
||||
:: safe? ( board q -- ? )
|
||||
[let q board nth :> x
|
||||
q iota [
|
||||
q <iota> [
|
||||
x swap
|
||||
[ board nth ] keep
|
||||
q swap -
|
||||
|
|
@ -15,10 +15,10 @@ IN: queens
|
|||
] ;
|
||||
|
||||
: solution? ( board -- ? )
|
||||
dup length iota [ dupd safe? ] all? nip ;
|
||||
dup length <iota> [ dupd safe? ] all? nip ;
|
||||
|
||||
: queens ( n -- l )
|
||||
iota all-permutations [ solution? ] filter ;
|
||||
<iota> all-permutations [ solution? ] filter ;
|
||||
|
||||
: .queens ( n -- )
|
||||
queens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue