# herrahlstrom/adventofcode architecture

> Architecture diagram of the GitHub repository herrahlstrom/adventofcode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/herrahlstrom/adventofcode
- Repository: https://github.com/herrahlstrom/adventofcode

## Overview

This repository is a console-based Advent of Code solution runner. The workflow is: select puzzles by year/day, instantiate each selected solution, run its two parts, and display answers and elapsed time. Puzzle implementations read their year/day input files through a shared reader and compute puzzle-specific results. The tree shows solutions for 2021–2024; the source excerpts confirm reflection-based dispatch and representative puzzle behaviors. Most individual puzzle files were not sampled, so year-level nodes preserve those solution branches without asserting their internal details.

Main entry points: [`Program.cs`](https://github.com/herrahlstrom/adventofcode/blob/main/Program.cs) (Runner), [`Helper/InputReader.cs`](https://github.com/herrahlstrom/adventofcode/blob/main/Helper/InputReader.cs) (Input reader), [`Puzzles/2021`](https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2021) (2021 puzzles), [`IPuzzle.cs`](https://github.com/herrahlstrom/adventofcode/blob/main/IPuzzle.cs) (Puzzle contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runner["Puzzle runner"]
  node_program["Runner<br/>[Program.cs]"]
  node_contract["Puzzle contract<br/>[IPuzzle.cs]"]
  node_metadata["Puzzle metadata<br/>[Attributes.cs]"]
end

subgraph group_solutions["Puzzle solutions"]
  node_puzzles2021["2021 puzzles"]
  node_snailfish["Snailfish solver<br/>[Year2021Day18.cs]"]
  node_puzzles2022["2022 puzzles"]
  node_puzzles2023["2023 puzzles"]
  node_puzzles2024["2024 puzzles"]
end

subgraph group_shared["Shared utilities"]
  node_inputreader["Input reader<br/>[InputReader.cs]"]
  node_point["Grid point<br/>[Point.cs]"]
  node_extensions["Collection helpers"]
  node_mapextensions["Map helpers<br/>[MapExtensions.cs]"]
  node_reverseiterator["Reverse iterator"]
end

node_user(("CLI user"))

node_user -->|"selects puzzles"| node_program
node_program -->|"runs methods"| node_contract
node_program -->|"filters by attributes"| node_metadata
node_program -.->|"discovers implementations"| node_puzzles2021
node_program -.->|"discovers implementations"| node_puzzles2022
node_program -.->|"discovers implementations"| node_puzzles2023
node_program -.->|"discovers implementations"| node_puzzles2024
node_puzzles2021 -->|"implements"| node_contract
node_puzzles2022 -->|"implements"| node_contract
node_puzzles2023 -->|"implements"| node_contract
node_puzzles2024 -->|"implements"| node_contract
node_puzzles2021 -->|"reads input"| node_inputreader
node_puzzles2022 -->|"reads input"| node_inputreader
node_puzzles2023 -->|"reads input"| node_inputreader
node_puzzles2024 -->|"reads input"| node_inputreader
node_snailfish -->|"reads input"| node_inputreader
node_puzzles2021 -.->|"includes solver"| node_snailfish
node_inputreader -->|"gets puzzle attributes"| node_metadata
node_puzzles2021 -->|"uses coordinates"| node_point
node_puzzles2022 -->|"uses coordinates"| node_point
node_puzzles2023 -->|"uses coordinates"| node_point
node_puzzles2024 -->|"uses coordinates"| node_point
node_mapextensions -->|"uses coordinates"| node_point

click node_program "https://github.com/herrahlstrom/adventofcode/blob/main/Program.cs"
click node_contract "https://github.com/herrahlstrom/adventofcode/blob/main/IPuzzle.cs"
click node_metadata "https://github.com/herrahlstrom/adventofcode/blob/main/Attributes.cs"
click node_puzzles2021 "https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2021"
click node_snailfish "https://github.com/herrahlstrom/adventofcode/blob/main/Puzzles/2021/Year2021Day18.cs"
click node_puzzles2022 "https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2022"
click node_puzzles2023 "https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2023"
click node_puzzles2024 "https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2024"
click node_inputreader "https://github.com/herrahlstrom/adventofcode/blob/main/Helper/InputReader.cs"
click node_point "https://github.com/herrahlstrom/adventofcode/blob/main/Helper/Point.cs"
click node_extensions "https://github.com/herrahlstrom/adventofcode/blob/main/Helper/CollectionExtensions.cs"
click node_mapextensions "https://github.com/herrahlstrom/adventofcode/blob/main/Helper/MapExtensions.cs"
click node_reverseiterator "https://github.com/herrahlstrom/adventofcode/blob/main/Helper/ReverseStringIterator.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_contract,node_metadata,node_user toneBlue
class node_puzzles2021,node_snailfish,node_puzzles2022,node_puzzles2023,node_puzzles2024 toneAmber
class node_inputreader,node_point,node_extensions,node_mapextensions,node_reverseiterator toneMint
```

## Components

### Puzzle runner

- [Runner](https://github.com/herrahlstrom/adventofcode/blob/main/Program.cs): `Program.cs`
- [Puzzle contract](https://github.com/herrahlstrom/adventofcode/blob/main/IPuzzle.cs): `IPuzzle.cs`
- [Puzzle metadata](https://github.com/herrahlstrom/adventofcode/blob/main/Attributes.cs): `Attributes.cs`

### Puzzle solutions

- [2021 puzzles](https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2021): `Puzzles/2021`
- [Snailfish solver](https://github.com/herrahlstrom/adventofcode/blob/main/Puzzles/2021/Year2021Day18.cs): `Puzzles/2021/Year2021Day18.cs`
- [2022 puzzles](https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2022): `Puzzles/2022`
- [2023 puzzles](https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2023): `Puzzles/2023`
- [2024 puzzles](https://github.com/herrahlstrom/adventofcode/tree/main/Puzzles/2024): `Puzzles/2024`

### Shared utilities

- [Input reader](https://github.com/herrahlstrom/adventofcode/blob/main/Helper/InputReader.cs): `Helper/InputReader.cs`
- [Grid point](https://github.com/herrahlstrom/adventofcode/blob/main/Helper/Point.cs): `Helper/Point.cs`
- [Collection helpers](https://github.com/herrahlstrom/adventofcode/blob/main/Helper/CollectionExtensions.cs): `Helper/CollectionExtensions.cs`
- [Map helpers](https://github.com/herrahlstrom/adventofcode/blob/main/Helper/MapExtensions.cs): `Helper/MapExtensions.cs`
- [Reverse iterator](https://github.com/herrahlstrom/adventofcode/blob/main/Helper/ReverseStringIterator.cs): `Helper/ReverseStringIterator.cs`

### Other components

- **CLI user**

## Connections

- CLI user → Runner: selects puzzles (evidence: `Program.cs`)
- Runner → Puzzle contract: runs methods (evidence: `Program.cs`)
- Runner → Puzzle metadata: filters by attributes (evidence: `Program.cs`)
- Runner → 2021 puzzles: discovers implementations
- Runner → 2022 puzzles: discovers implementations
- Runner → 2023 puzzles: discovers implementations
- Runner → 2024 puzzles: discovers implementations
- 2021 puzzles → Puzzle contract: implements (evidence: `Puzzles/2021/Year2021Day04.cs`)
- 2022 puzzles → Puzzle contract: implements (evidence: `Puzzles/2022/Year2022Day05.cs`)
- 2023 puzzles → Puzzle contract: implements (evidence: `Puzzles/2023/Year2023Day05.cs`)
- 2024 puzzles → Puzzle contract: implements (evidence: `Puzzles/2024/Year2024Day03.cs`)
- 2021 puzzles → Input reader: reads input (evidence: `Puzzles/2021/Year2021Day04.cs`)
- 2022 puzzles → Input reader: reads input (evidence: `Puzzles/2022/Year2022Day05.cs`)
- 2023 puzzles → Input reader: reads input (evidence: `Puzzles/2023/Year2023Day05.cs`)
- 2024 puzzles → Input reader: reads input (evidence: `Puzzles/2024/Year2024Day03.cs`)
- Snailfish solver → Input reader: reads input (evidence: `Puzzles/2021/Year2021Day18.cs`)
- 2021 puzzles → Snailfish solver: includes solver
- Input reader → Puzzle metadata: gets puzzle attributes (evidence: `Helper/InputReader.cs`)
- 2021 puzzles → Grid point: uses coordinates (evidence: `Puzzles/2021/Year2021Day09.cs`)
- 2022 puzzles → Grid point: uses coordinates (evidence: `Puzzles/2022/Year2022Day12.cs`)
- 2023 puzzles → Grid point: uses coordinates (evidence: `Puzzles/2023/Year2023Day10.cs`)
- 2024 puzzles → Grid point: uses coordinates (evidence: `Puzzles/2024/Year2024Day04.cs`)
- Map helpers → Grid point: uses coordinates (evidence: `Helper/MapExtensions.cs`)
