aboutsummaryrefslogtreecommitdiff
path: root/Puzzle10.hs
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2017-12-14 16:32:31 +0100
committerYuchen Pei <me@ypei.me>2017-12-14 16:32:31 +0100
commit5dfee5ce272db6827aecd13bc2902be50dcf21b0 (patch)
treeb8ca7779e3653993f8e9028129fcbc96f1445140 /Puzzle10.hs
parent87c005e7577ddc214b604e28b27f5c46a9d9edec (diff)
finished Day 14 part 1
Diffstat (limited to 'Puzzle10.hs')
-rw-r--r--Puzzle10.hs6
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"