This repository contains solutions to various puzzles of the Advent of Code 2021. Puzzles are solved with various idioms and libraries from the Scala ecosystem.
Ammonite is used to run the code.
It is available from many package managers (e.g. brew install ammonite-repl
).
When running a puzzle solution (e.g. amm day02.sc
) dependencies will be downloaded automatically.
Custom runner is used to run the solution code with example and real inputs. Runner registers all of the assertions in the solution and prints out results table at the end:
┌───┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┐
│ │ Assertion │ Example value (expected) │ Real value (expected) │
├───┼─────────────────────────────┼─────────────────────────────┼─────────────────────────────┤
│ ✓ │ final position │ 150 (150) │ 1383564 (1383564) │
├───┼─────────────────────────────┼─────────────────────────────┼─────────────────────────────┤
│ ✓ │ hoz with aim │ 15 (15) │ 1911 (1911) │
├───┼─────────────────────────────┼─────────────────────────────┼─────────────────────────────┤
│ ✓ │ depth with aim │ 60 (60) │ 778813 (778813) │
├───┼─────────────────────────────┼─────────────────────────────┼─────────────────────────────┤
│ ✓ │ position with aim │ 900 (900) │ 1488311643 (1488311643) │
└───┴─────────────────────────────┴─────────────────────────────┴─────────────────────────────┘
List of solutions and Scala idioms/libraries used: