diff options
Diffstat (limited to 'Puzzle10.hs')
-rw-r--r-- | Puzzle10.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Puzzle10.hs b/Puzzle10.hs index fc01499..4af8105 100644 --- a/Puzzle10.hs +++ b/Puzzle10.hs @@ -1,3 +1,4 @@ +module Puzzle10 (knotHash) where import Data.List.Split (splitOn) import Data.Bits (xor) import Numeric (showHex) @@ -47,6 +48,9 @@ denseHash :: [Int] -> [Char] denseHash xs = mconcat $ fmap (int2Hex . fst) $ take 16 $ drop 1 $ iterate stepHash (0, xs) solve2 :: [Char] -solve2 = denseHash $ sparseHash $ (ord <$> input) ++ [17, 31, 73, 47, 23] +solve2 = knotHash input + +knotHash :: [Char] -> [Char] +knotHash xs = denseHash $ sparseHash $ (ord <$> xs) ++ [17, 31, 73, 47, 23] input = "120,93,0,90,5,80,129,74,1,165,204,255,254,2,50,113" |