This commit is contained in:
George Thomas 2025-12-08 22:42:57 +00:00
parent d0488726a0
commit 25efc19b31

View File

@ -13,20 +13,22 @@ puzzle =
{ number = 8 { number = 8
, parser = \isRealData -> (if isRealData then 1000 else 10,) <$> (V3 <$> decimal <* single ',' <*> decimal <* single ',' <*> decimal) `sepEndBy` newline , parser = \isRealData -> (if isRealData then 1000 else 10,) <$> (V3 <$> decimal <* single ',' <*> decimal <* single ',' <*> decimal) `sepEndBy` newline
, parts = , parts =
[ uncurry \n -> TL.show [ uncurry \n ->
. product TL.show
. take 3 . product
. sortOn Down . take 3
. map length . sortOn Down
. DS.toLists . map length
. snd . DS.toLists
. (!! n) . snd
. connectBoxes . (!! n)
, uncurry . const $ TL.show . connectBoxes
. maybe (error "sets never unified") (\((V3 x1 _ _, V3 x2 _ _), _) -> x1 * x2) , uncurry . const $
. lastMay TL.show
. takeWhile ((> 1) . DS.sets . snd) . maybe (error "sets never unified") (\((V3 x1 _ _, V3 x2 _ _), _) -> x1 * x2)
. connectBoxes . lastMay
. takeWhile ((> 1) . DS.sets . snd)
. connectBoxes
] ]
, extraTests = mempty , extraTests = mempty
} }