Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1 +1,3 @@
possible=: ((i.!5) A. i.5) { 'BCFMS'
'B C F M S'=:<"1|: P=:(!A.&i.])5 NB. perm matrix and named columns
Cs=: (B~:4),(C~:0),(F~:4),(F~:0),(M>C),(1<|S-F),:(1<|F-C) NB. constraints
'BCFMS'/:{.P#~*./Cs NB. join constraints; filter; apply resulting permutation

View file

@ -1,9 +1,12 @@
possible=: (#~ 'B' ~: {:"1) possible NB. Baker not on top floor
possible=: (#~ 'C' ~: {."1) possible NB. Cooper not on bottom floor
possible=: (#~ 'F' ~: {:"1) possible NB. Fletcher not on top floor
possible=: (#~ 'F' ~: {."1) possible NB. Fletcher not on bottom floor
possible=: (#~ </@i."1&'CM') possible NB. Miller on higher floor than Cooper
possible=: (#~ 0 = +/@E."1~&'SF') possible NB. Smith not immediately below Fletcher
possible=: (#~ 0 = +/@E."1~&'FS') possible NB. Fletcher not immediately below Smith
possible=: (#~ 0 = +/@E."1~&'CF') possible NB. Cooper not immediately below Fletcher
possible=: (#~ 0 = +/@E."1~&'FC') possible NB. Fletcher not immediately below Cooper
'B C F M S'=:<"1|: P=:(!A.&i.])5 NB. perm matrix and named columns
NB. parse constraints -> fold -> filter:
'BCFMS'/:{.P#~*./ ".;._2 (0 :0)
B~:4 NB. Baker not on 5th floor
C~:0 NB. Cooper not on 1st floor
F~:4 NB. Fletcher not on 5th floor...
F~:0 NB. ... nor on 1st floor
M>C NB. Miller on higher floor than Cooper
1<|S-F NB. Smith and Fletcher not on adjacent floors
1<|F-C NB. Fletcher and Cooper not on adjacent floors
)

View file

@ -1,2 +1,4 @@
possible
SCBFM
P=: (!A.&i.])5 NB. permutation matrix
'`B C F M S'=: ,{{y&{"1`''}}&>i.5 NB. e.g., B is 0&{"1
Cs=: (B~:4:)`(C~:0:)`(F~:4:)`(F~:0:)`(M>C)`(1<S|@:-F)`(1<F|@:-C) NB. gerund constraints
'BCFMS' /: {. P [F..{{(x`:6#])y}} Cs NB. fold, filtering as we go

View file

@ -0,0 +1 @@
P=: ({~(!A.&i.])@#)'BCFMS' NB. all permutations (orderings)

View file

@ -0,0 +1,9 @@
P=: (#~ 'B' ~: {:"1) P NB. Baker not on top floor
P=: (#~ 'C' ~: {."1) P NB. Cooper not on bottom floor
P=: (#~ 'F' ~: {:"1) P NB. Fletcher not on top floor
P=: (#~ 'F' ~: {."1) P NB. Fletcher not on bottom floor
P=: (#~ </@i."1&'CM') P NB. Miller on higher floor than Cooper
P=: (#~ 0 = +/@E."1~&'SF') P NB. Smith not immediately below Fletcher
P=: (#~ 0 = +/@E."1~&'FS') P NB. Fletcher not immediately below Smith
P=: (#~ 0 = +/@E."1~&'CF') P NB. Cooper not immediately below Fletcher
P=: (#~ 0 = +/@E."1~&'FC') P NB. Fletcher not immediately below Cooper

View file

@ -0,0 +1,11 @@
(({~(!A.&i.])@#)'BCFMS') [F..(128!:2"1 # ]) ];._2 (0 :0)
'B' ~: {: NB. Baker not on top floor
'C' ~: {. NB. Cooper not on bottom floor
'F' ~: {: NB. Fletcher not on top floor
'F' ~: {. NB. Fletcher not on bottom floor
</@i.&'CM' NB. Miller on higher floor than Cooper
0 = +/@E.~&'SF' NB. Smith not immediately below Fletcher
0 = +/@E.~&'FS' NB. Fletcher not immediately below Smith
0 = +/@E.~&'CF' NB. Cooper not immediately below Fletcher
0 = +/@E.~&'FC' NB. Fletcher not immediately below Cooper
)