Skip to content

2m/adventofcode2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

Puzzle Idioms and libraries
Day 1 Ammonite Ops, Collections Sliding Window
Day 2 Match on interpolator
Day 3 Parsing text to integers
Day 4 Mutable vars
Day 5 zip
Day 6 Map.updatedWith
Day 7 Sum of consecutive numbers
Day 8 Set intersection
Day 9 foldLeft
Day 10 Extractor objects
Day 11 Unfold
Day 12
Day 13
Day 14

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages