My version:
clue =: ([^:(__ e. ]) __&".)&.>@;:;._2 wd 'clippaste'
names =: {."1 clue
clueval =: 1 {::"1 clue
NB. Get list of boxes, each containg a list of att:value
db =: <@:(2&}.)@(([^:(__ e. ]) __&".)&.>@;:);._2 ',' -.~ (#~ [: -.
(LF,LF)&E.) wd'clippaste'
NB. Create list of values for each aunt
dbflat =: (names (1&{::"1@])`(i. {."1)`(_"0@[)} _2&(]\))@> db
NB. Find lines that contain at least as much stuff as was found
I. dbflat ([: *./ (_ ~: [) # =)"1 clueval
NB. Replace clueval with range
rclueval =: 2 #"0 clueval
NB. Change the datatypes called for in the problem
rcv =: (names i. ;:'cats: trees:') (1 _ +"1 {)`([)`]} rclueval
rcv =: (names i. ;:'pomeranians: goldfish:') (__ _1 +"1 {)`([)`]} rcv
NB. Test for within range
I. dbflat ([: *./ (_ ~: [) # ((>: {.) *. (<: {:))"_1)"1 2 rcv
Henry Rich
On 12/16/2015 5:16 PM, David Lambert wrote:
adventofcode/day/16
My solution is posted at
http://forums.devshed.com/programming-languages/972280-reversed-post2964093.html#post2964093
It may be slightly simpler than the others on this thread. Observing
that the machine output matched the memories, the essence of my
solution is an E. table. On hindsight it would not have given an
unique solution for Sue with 32 children. I suspect I'd have noticed
this condition. I solved part 2 with a partial filter and then by hand.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm