sln_2017_10
Copyright(c) Eric Mertens 2017
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Main

Description

https://adventofcode.com/2017/day/10

Day 10 poses a convoluted knot-tying algorithm to implement.

Synopsis

Documentation

main :: IO () Source #

Print the solution to both parts of Day 10. Input file is configurable via the command-line.

>>> :main
23874
e1a65bfb5a5ce396025fab5528c25a87

part1 Source #

Arguments

:: String

input string

-> String

output hash

Compute the product of the first two elements after performing the knot-tying ritual using the lengths given as inputs.

>>> part1 5 "3,4,1,5"
"12"

part2 Source #

Arguments

:: String

input string

-> String

output hash

Given a rope size and an input string, compute the resulting hash.

>>> part2 256 ""
"a2582a3a0e66e6e86e3812dcb672a272"
>>> part2 256 "AoC 2017"
"33efeb34ea91902bb2f59c9920caa6cd"
>>> part2 256 "1,2,3"
"3efbe78a8d82f29979031a4aa0b16a9d"
>>> part2 256 "1,2,4"
"63960835bcdc130f0b66d7ff4f6a5a8e"

part1Input Source #

Arguments

:: String

input string

-> [Int]

rope lengths

Transform the input string according to the part 1 rule to produce the list of knot lengths required.

>>> part1Input "1,2,3"
[1,2,3]

part2Input Source #

Arguments

:: String

input string

-> [Int]

rope lengths

Transform the input string according to the part 2 rule to produce the list of knot lengths required.

>>> part2Input "1,2,3"
[49,44,50,44,51,17,31,73,47,23]