Random Link ¯\_(ツ)_/¯ | ||
Apr 11, 2022 | » | AoC 2021 Parsing Arguments
2 min; updated Apr 11, 2022
Parsing the Command Line lists a couple of libraries. and are the most popular options. Going with as it’s slightly more popular. {-# OPTIONS_GHC -Wall #-} module AoC2021Args (Args(..), aocArgParser) where import Options.Applicative import Data.Semigroup ((<>)) data Args = Args { day :: Int } aocArgParser :: Parser Args aocArgParser = Args <$> option auto ( long "day" <> help "The day to run code for. Use '0' to run all of the solutions.... |
Mar 16, 2022 | » | AoC 2021 Day 09: Smoke Basin
13 min; updated Mar 16, 2022
Multi-dimensional arrays using |
Mar 7, 2022 | » | AoC 2021 Day 08: Seven Segment Search
15 min; updated Mar 7, 2022
Day 8 - Advent of Code 2021. adventofcode.com . Accessed Mar 7, 2022. Part I Description You barely reach the safety of the cave when the whale smashes into the cave mouth, collapsing it. Sensors indicate another exit to this cave at a much greater depth, so you have no choice but to press on. As your submarine slowly makes its way through the cave system, you notice that the four-digit seven-segment displays in your submarine are malfunctioning; they must have been damaged during the escape.... |
Mar 1, 2022 | » | AoC 2021 Day 06: Lanternfish
12 min; updated Mar 1, 2022
Day 6 - Advent of Code 2021. adventofcode.com . Accessed Mar 2, 2022. Part I Description The sea floor is getting steeper. Maybe the sleigh keys got carried this way? A massive school of glowing lanternfish swims past. They must spawn quickly to reach such large numbers - maybe exponentially quickly? You should model their growth to be sure. Although you know nothing about this specific species of lanternfish, you make some guesses about their attributes.... |
Feb 23, 2022 | » | AoC 2021 Day 03: Binary Diagnostic
14 min; updated Feb 23, 2022
Day 3 - Advent of Code 2021. adventofcode.com . Accessed Feb 23, 2022. Problem Description Part One The submarine has been making some odd creaking noises, so you ask it to produce a diagnostic report just in case. The diagnostic report (your puzzle input) consists of a list of binary numbers which, when decoded properly, can tell you many useful things about the conditions of the submarine.... |
Feb 19, 2022 | » | Learning Haskell via AoC 2021
17 min; updated Feb 19, 2022
This page contains remarks on Haskell that I encountered when working with source files that span multiple AoC 2021 problems. and have Haskell solutions. It’ll be nice to compare how they solved the problems. I don’t want to end up perfecting the wrong approach! Setting Up Haskell Env for AoC To manage dependencies, Cabal and Stack are pretty popular. Stack incorporates the Cabal build system.... |
Feb 6, 2021 | » | 021. Amicable Numbers
8 min; updated Feb 6, 2021
Problem Statement Let \(d(n)\) be defined as the sum of proper divisors of \(n\) (numbers less than \(n\) which divide evenly into \(n\)). If \(d(a) = b\) and \(d(b) = a\), where \(a \neq b\), then \(a\) and \(b\) are an amicable pair and each of \(a\) and \(b\) are called amicable numbers. For example, the proper divisors of \(220\) are \(1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110\); therefore \(d(220) = 284\).... |