/AdventOfCode-2022

🎄 My solutions to the 2022 edition of "Advent of Code".

Primary LanguageScalaMIT LicenseMIT

My solutions to the 2022 edition of Advent of Code.

Previous participations

Problem statements & solutions

Day Code
01 solution
02 solution
03 solution
04 solution
05 solution
06 solution
07 solution
08 solution
09 solution
10 solution
11 solution
12 solution
13 solution
14 solution
15 solution
16 solution
17 solution
18 solution
19 solution
20 solution
21 solution
22 solution
23 solution
24 solution
25 solution

In order to make the challenge more interesting, I set myself the following rules:

  • Pure: no usage of var or mutable datastructures
  • Self-contained: no third-party libraries, one file per day (*)
  • Efficient: optimal asymptotic complexity, as far as reasonable
  • Concise: readability is key

Note that these rules do not necessarily apply while solving a problem, but rather when committing the code to this repository.

(*): this rule could be subject to modification, for instance if the puzzles implicitly require it (Intcode in 2019).

Usage

This project runs on Scala 3.2.1 and sbt 1.8.0.

Use the following template to write a solution for a given day:

package adventofcode.solutions

import adventofcode.Definitions.*

@main def Day01 = Day(1) { (input, part) =>

  part(1) = ???

  part(2) = ???

}

(change 1 to the current day number and fill in the ???)

Paste your input as a file named 01.txt in input/.

To run the code, enter sbt run Day01.

The output(s) will be printed to the console and stored in output/ as 01-1.txt and 01-2.txt.

Additionally, the command sbt test will run all the implemented solutions and compare their result against the currently stored output, to detect any potential regression.

License

MIT