adventofcode-0.1.0.0: Haskell solutions to adventofcode
LicenseMIT
Maintainer@tylerjl
Safe HaskellSafe-Inferred
LanguageHaskell2010

Y2021.D05

Description

Solutions to the 2021 day 05 set of problems for adventofcode.com.

Synopsis

Documentation

type Point = (Int, Int) #

Makes some signatures easier to read

type Line = (Point, Point) #

Makes some signatures easier to read

type Points = HashMap Point (Sum Int) #

Makes some signatures easier to read

part5A :: Text -> Int #

Solve part A

part5B :: Text -> Int #

Solve part B

solve5 :: ([Line] -> [Line]) -> Text -> Int #

Higher-order function solution to share parts A and B.

lineTo :: Line -> [(Point, Sum Int)] #

Accept a start and end point and return a list of points that draw a line to the endpoint. Note that this doesn't work for anything other than vertical, horizontal, and 45deg.

parseVents :: Text -> [Line] #

Parse puzzle input into simple pairs of pairs of points.