# molson82/adventofcode architecture

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

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

## Overview

##### Main Components

a. Core Structure:
- Year-based Solution Modules (2019-2024)
- Shared Package Components (pkg/)
- Test Infrastructure
- Utility Scripts

b. Package Components:
- Models Package
- Utils Package
- Input Processing System
- Solution Runner

**┌─ Project Core ─────────────────────────────────────────┐**

- ┌─ Solution Modules ─┐  ┌─ Shared Components ───────┐ │
- 2019/            │  │  pkg/                      │ │
- 2020/            │  │  ├─ models/               │ │
- 2021/            │  │  │  └─ set.go            │ │
- 2022/            │  │  └─ utils/               │ │
- 2023/            │  │     ├─ err.go            │ │
- 2024/            │  │     ├─ input.go          │ │
- Each containing: │  │     ├─ list.go           │ │
- Daily Solutions│  │     ├─ math.go           │ │
- Test Files     │  │     └─ string.go         │ │
- Input Files    │  │                          │ │
- ┘  └──────────────────────────┘ │

- ┘

##### Flow Indicators

- Dependencies between solutions and shared utilities
- Data flow from input files to solution modules
- Test execution paths

##### Implementation Details

Specific components:
- Main execution entry point (main.go)
- Solution structure (dayN.go files)
- Test suite organization
- Utility function groupings

##### The test-driven development approach

Keep the abstraction level focused on the architectural organization while showing the clear separation between solution modules and shared utilities. This will help developers understand both the overall structure and how to add new solutions maintaining the established patterns.

Remember to include notes about:
- The standardized file naming convention
- The relationship between test files and solution files
- The utility package organization
- The input file handling pattern

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Project["Project Core"]
        Main["Solution Runner"]:::runner
        Scripts["Utility Scripts"]:::scripts

        subgraph Years["Solution Modules"]
            Y2019["2019"]:::year
            Y2020["2020"]:::year
            Y2021["2021"]:::year
            Y2022["2022"]:::year
            Y2023["2023"]:::year
            Y2024["2024"]:::year

            subgraph DayStructure["Daily Solution Structure"]
                Solution["Solution File"]:::solution
                Input["Input File"]:::input
                Sample["Sample File"]:::input
                Test["Test Files"]:::test
            end
        end

        subgraph Shared["Shared Components"]
            subgraph Models["Models Package"]
                Set["Set Implementation"]:::code
            end

            subgraph Utils["Utils Package"]
                ErrorUtils["Error Utilities"]:::code
                InputProc["Input Processing"]:::code
                ListUtils["List Utilities"]:::code
                MathUtils["Math Utilities"]:::code
                StringUtils["String Utilities"]:::code
            end
        end
    end

    %% Relationships
    Main --> Years
    Main --> Utils
    Years --> Utils
    Years --> Models
    DayStructure --> Utils
    Scripts --> Years

    %% Click Events
    click Main "https://github.com/molson82/adventofcode/blob/main/main.go"
    click Scripts "https://github.com/molson82/adventofcode/blob/main/new.sh"
    click Y2019 "https://github.com/molson82/adventofcode/tree/main/2019/"
    click Y2020 "https://github.com/molson82/adventofcode/tree/main/2020/"
    click Y2021 "https://github.com/molson82/adventofcode/tree/main/2021/"
    click Y2022 "https://github.com/molson82/adventofcode/tree/main/2022/"
    click Y2023 "https://github.com/molson82/adventofcode/tree/main/2023/"
    click Y2024 "https://github.com/molson82/adventofcode/tree/main/2024/"
    click Models "https://github.com/molson82/adventofcode/tree/main/pkg/models/"
    click Set "https://github.com/molson82/adventofcode/blob/main/pkg/models/set.go"
    click Utils "https://github.com/molson82/adventofcode/tree/main/pkg/utils/"
    click ErrorUtils "https://github.com/molson82/adventofcode/blob/main/pkg/utils/err.go"
    click InputProc "https://github.com/molson82/adventofcode/blob/main/pkg/utils/input.go"
    click ListUtils "https://github.com/molson82/adventofcode/blob/main/pkg/utils/list.go"
    click MathUtils "https://github.com/molson82/adventofcode/blob/main/pkg/utils/math.go"
    click StringUtils "https://github.com/molson82/adventofcode/blob/main/pkg/utils/string.go"
    click Test "https://github.com/molson82/adventofcode/blob/main/2021/*/day*_test.go"
    click Solution "https://github.com/molson82/adventofcode/blob/main/202[1-4]/*/day*.go"
    click Input "https://github.com/molson82/adventofcode/blob/main/202[1-4]/*/input.txt"
    click Sample "https://github.com/molson82/adventofcode/blob/main/202[1-4]/*/sample.txt"

    %% Styling
    classDef year fill:#90EE90,stroke:#333,stroke-width:2px
    classDef code fill:#FFE5CC,stroke:#333,stroke-width:1px
    classDef solution fill:#AED6F1,stroke:#333,stroke-width:1px
    classDef input fill:#D7BDE2,stroke:#333,stroke-width:1px
    classDef test fill:#F5B7B1,stroke:#333,stroke-width:1px
    classDef runner fill:#85C1E9,stroke:#333,stroke-width:2px
    classDef scripts fill:#F9E79F,stroke:#333,stroke-width:1px

    %% Legend
    subgraph Legend
        L1["Year Module"]:::year
        L2["Code File"]:::code
        L3["Solution File"]:::solution
        L4["Input File"]:::input
        L5["Test File"]:::test
        L6["Runner"]:::runner
        L7["Scripts"]:::scripts
    end
```
