# npatel221/advent-of-code architecture

> Architecture diagram of the GitHub repository npatel221/advent-of-code, 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/npatel221/advent-of-code
- Repository: https://github.com/npatel221/advent-of-code

## Overview

This repository contains C++23 Advent of Code solutions, with separate executable workflows for Day 1’s safe-dial puzzle and Day 2’s invalid product-ID puzzle. Each accepts an input-file path, reads and parses puzzle input, runs its domain logic, and prints two answers. Shared file-reading code supports both workflows. The graph follows relationships visible in the sampled entry points and source index; it omits uncertain internal calls where implementation excerpts do not establish them.

Main entry points: [`2025/day1/main.cpp`](https://github.com/npatel221/advent-of-code/blob/main/2025/day1/main.cpp) (Day 1 runner), [`2025/day2/main.cpp`](https://github.com/npatel221/advent-of-code/blob/main/2025/day2/main.cpp) (Day 2 runner), [`2025/common/FileUtils.cpp`](https://github.com/npatel221/advent-of-code/blob/main/2025/common/FileUtils.cpp) (File reader), [`2025/day1/Command.cpp`](https://github.com/npatel221/advent-of-code/blob/main/2025/day1/Command.cpp) (Command parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared input"]
  node_fileutils["File reader<br/>[FileUtils.cpp]"]
end

subgraph group_day1["Day 1 safe"]
  node_day1main["Day 1 runner<br/>[main.cpp]"]
  node_command["Command parser<br/>[Command.cpp]"]
  node_safe["Safe dial<br/>[Safe.cpp]"]
  node_day1result["Day 1 passwords<br/>[main.cpp]"]
end

subgraph group_day2["Day 2 IDs"]
  node_day2main["Day 2 runner<br/>[main.cpp]"]
  node_range["Range parser<br/>[Range.cpp]"]
  node_validator["ID validator"]
  node_day2result["Invalid-ID sums<br/>[main.cpp]"]
end

node_user(("Puzzle solver"))
node_input["Input file"]

node_user -->|"runs with path"| node_day1main
node_user -->|"runs with path"| node_day2main
node_day1main -->|"reads input"| node_fileutils
node_input -->|"provides contents"| node_fileutils
node_day1main -->|"parses commands"| node_command
node_day1main -->|"applies rotations"| node_safe
node_day1main -->|"prints answers"| node_day1result
node_day2main -->|"reads input"| node_fileutils
node_input -->|"provides contents"| node_fileutils
node_day2main -->|"parses ranges"| node_range
node_day2main -->|"calculates sums"| node_validator
node_day2main -->|"prints answers"| node_day2result

click node_fileutils "https://github.com/npatel221/advent-of-code/blob/main/2025/common/FileUtils.cpp"
click node_day1main "https://github.com/npatel221/advent-of-code/blob/main/2025/day1/main.cpp"
click node_command "https://github.com/npatel221/advent-of-code/blob/main/2025/day1/Command.cpp"
click node_safe "https://github.com/npatel221/advent-of-code/blob/main/2025/day1/Safe.cpp"
click node_day1result "https://github.com/npatel221/advent-of-code/blob/main/2025/day1/main.cpp"
click node_day2main "https://github.com/npatel221/advent-of-code/blob/main/2025/day2/main.cpp"
click node_range "https://github.com/npatel221/advent-of-code/blob/main/2025/day2/Range.cpp"
click node_validator "https://github.com/npatel221/advent-of-code/blob/main/2025/day2/ProductIdValidator.cpp"
click node_day2result "https://github.com/npatel221/advent-of-code/blob/main/2025/day2/main.cpp"

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_fileutils toneBlue
class node_day1main,node_command,node_safe,node_day1result toneAmber
class node_day2main,node_range,node_validator,node_day2result toneMint
class node_user,node_input toneIndigo
```

## Components

### Shared input

- [File reader](https://github.com/npatel221/advent-of-code/blob/main/2025/common/FileUtils.cpp): `2025/common/FileUtils.cpp`

### Day 1 safe

- [Day 1 runner](https://github.com/npatel221/advent-of-code/blob/main/2025/day1/main.cpp): `2025/day1/main.cpp`
- [Command parser](https://github.com/npatel221/advent-of-code/blob/main/2025/day1/Command.cpp): `2025/day1/Command.cpp`
- [Safe dial](https://github.com/npatel221/advent-of-code/blob/main/2025/day1/Safe.cpp): `2025/day1/Safe.cpp`
- [Day 1 passwords](https://github.com/npatel221/advent-of-code/blob/main/2025/day1/main.cpp): `2025/day1/main.cpp`

### Day 2 IDs

- [Day 2 runner](https://github.com/npatel221/advent-of-code/blob/main/2025/day2/main.cpp): `2025/day2/main.cpp`
- [Range parser](https://github.com/npatel221/advent-of-code/blob/main/2025/day2/Range.cpp): `2025/day2/Range.cpp`
- [ID validator](https://github.com/npatel221/advent-of-code/blob/main/2025/day2/ProductIdValidator.cpp): `2025/day2/ProductIdValidator.cpp`
- [Invalid-ID sums](https://github.com/npatel221/advent-of-code/blob/main/2025/day2/main.cpp): `2025/day2/main.cpp`

### Other components

- **Puzzle solver**
- **Input file**

## Connections

- Puzzle solver → Day 1 runner: runs with path (evidence: `2025/day1/main.cpp`)
- Puzzle solver → Day 2 runner: runs with path (evidence: `2025/day2/main.cpp`)
- Day 1 runner → File reader: reads input (evidence: `2025/day1/main.cpp`)
- Input file → File reader: provides contents (evidence: `2025/common/FileUtils.cpp`)
- Day 1 runner → Command parser: parses commands (evidence: `2025/day1/main.cpp`)
- Day 1 runner → Safe dial: applies rotations (evidence: `2025/day1/main.cpp`)
- Day 1 runner → Day 1 passwords: prints answers (evidence: `2025/day1/main.cpp`)
- Day 2 runner → File reader: reads input (evidence: `2025/day2/main.cpp`)
- Input file → File reader: provides contents (evidence: `2025/common/FileUtils.cpp`)
- Day 2 runner → Range parser: parses ranges (evidence: `2025/day2/main.cpp`)
- Day 2 runner → ID validator: calculates sums (evidence: `2025/day2/main.cpp`)
- Day 2 runner → Invalid-ID sums: prints answers (evidence: `2025/day2/main.cpp`)
