sln_2021_09
Copyright(c) Eric Mertens 2021
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Main

Description

https://adventofcode.com/2021/day/9

Find the basins on the height map.

>>> :{
exampleGrid =
  Data.Array.Unboxed.listArray
    (C 0 0, C 4 9)
    [2,1,9,9,9,4,3,2,1,0,
     3,9,8,7,8,9,4,9,2,1,
     9,8,5,6,7,8,9,8,9,2,
     8,7,6,7,8,9,6,7,8,9,
     9,8,9,9,9,6,5,6,7,8]
:}
>>> exampleBasins = toBasinIds exampleGrid
>>> basinRiskSum exampleGrid exampleBasins
15
>>> basinSizes exampleBasins
[3,9,14,9]
Synopsis

Documentation

main :: IO () Source #

>>> :main
588
964712