Solve day 8 part 2

This commit is contained in:
George Thomas 2025-12-08 22:01:49 +00:00
parent c39113dd0e
commit 43918c70fa
3 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,7 @@ module Pre (
module Data.Void, module Data.Void,
module Data.Word, module Data.Word,
module Linear, module Linear,
module Safe,
module Test.Tasty, module Test.Tasty,
module Test.Tasty.Golden, module Test.Tasty.Golden,
module Test.Tasty.HUnit, module Test.Tasty.HUnit,
@ -71,6 +72,7 @@ import Data.Traversable
import Data.Void import Data.Void
import Data.Word import Data.Word
import Linear (V2 (..)) import Linear (V2 (..))
import Safe
import Test.Tasty import Test.Tasty
import Test.Tasty.Golden hiding (Always) import Test.Tasty.Golden hiding (Always)
import Test.Tasty.HUnit import Test.Tasty.HUnit

View File

@ -24,6 +24,11 @@ puzzle =
-- TODO more principled way of distinguishing example and real -- TODO more principled way of distinguishing example and real
(!! ((if length boxes == 20 then 10 else if length boxes == 1000 then 1000 else undefined))) $ (!! ((if length boxes == 20 then 10 else if length boxes == 1000 then 1000 else undefined))) $
connectBoxes boxes connectBoxes boxes
, TL.show
. maybe (error "sets never unified") (\((V3 x1 _ _, V3 x2 _ _), _) -> x1 * x2)
. lastMay
. takeWhile ((> 1) . DS.sets . snd)
. connectBoxes
] ]
, extraTests = mempty , extraTests = mempty
} }

1
outputs/real/8/2 Normal file
View File

@ -0,0 +1 @@
78894156