# martyjre/advent_of_code_2023 architecture

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

- Interactive diagram: https://gitdiagram.com/martyjre/advent_of_code_2023
- Repository: https://github.com/martyjre/advent_of_code_2023

## Overview

##### Project type and purpose
- This is a small CLI‐based Kotlin project for solving the daily Advent of Code puzzles.
- Each “DayXX.kt” is one independent puzzle solution, using a shared template and utilities.

##### File structure
- Top level:
- build.gradle.kts / gradle/… / gradlew(.bat) – Gradle build and wrapper files
- settings.gradle.kts – project settings
- README.md / .gitignore
- Days/ – raw input files and test inputs for each day
- src/ – Kotlin source files
- Inside src/:
- Day01.kt – Day10.kt – one file per day’s solution
- DayTemplate.kt – skeleton for new days
- Utils.kt – shared helper functions (parsing, IO, common algorithms)

##### README
- Confirms this is an Advent of Code template in Kotlin.
- No web UI or network layer – purely computes puzzle answers from local input files.

##### Main components
a. CLI Runner (Gradle “run” task)
b. Day Modules (Day01 through Day10 classes)
c. Template Module (DayTemplate.kt – blueprint for new day modules)
d. Utilities Module (Utils.kt – parsing, common routines)
e. Input Data Store (Days/ folder: Day10.txt, tests)
f. Build System (Gradle)

##### Relationships and interactions
- The CLI Runner is invoked via Gradle or main() entrypoint.
- Runner discovers or is told which DayXX class to execute.
- A DayXX class:
- Reads raw puzzle input from Days/DayXX.txt (via Utils.IO functions)
- Processes the data using puzzle‐specific logic
- May call shared utility methods in Utils.kt
- Emits results to the console or test harness
- The Template module shows the developer where to plug in new Day modules.
- The Build System compiles all .kt files, resolves dependencies, and packages artifacts.

##### Architectural patterns and design principles
- Modular per‐day plugin pattern: each day is an independent module/class.
- Single responsibility: Utils.kt for shared code, one file per puzzle.
- Convention over configuration: file names match day numbers, template guides structure.

## Diagram (Mermaid)

```mermaid
flowchart TB
    title["Advent of Code 2023 Kotlin Architecture"]

    subgraph "Build System" 
        BS["Gradle Build System"]:::build
    end

    CLI["CLI Runner / Main Entrypoint"]:::code
    subgraph "Puzzle Solutions"
        D1["Day01.kt"]:::code
        D2["Day02.kt"]:::code
        D3["Day03.kt"]:::code
        D4["Day04.kt"]:::code
        D5["Day05.kt"]:::code
        D6["Day06.kt"]:::code
        D7["Day07.kt"]:::code
        D8["Day08.kt"]:::code
        D9["Day09.kt"]:::code
        D10["Day10.kt"]:::code
    end
    TEMPLATE["DayTemplate.kt"]:::code
    UTILS["Utils.kt"]:::code
    DATA["Days/ (Input Data)"]:::data

    BS -->|"builds"| CLI
    BS -->|"builds"| D1
    BS -->|"builds"| D2
    BS -->|"builds"| D3
    BS -->|"builds"| D4
    BS -->|"builds"| D5
    BS -->|"builds"| D6
    BS -->|"builds"| D7
    BS -->|"builds"| D8
    BS -->|"builds"| D9
    BS -->|"builds"| D10
    BS -->|"builds"| TEMPLATE
    BS -->|"builds"| UTILS

    CLI -->|"invokes"| D1
    CLI -->|"invokes"| D2
    CLI -->|"invokes"| D3
    CLI -->|"invokes"| D4
    CLI -->|"invokes"| D5
    CLI -->|"invokes"| D6
    CLI -->|"invokes"| D7
    CLI -->|"invokes"| D8
    CLI -->|"invokes"| D9
    CLI -->|"invokes"| D10

    D1 -->|"reads"| DATA
    D2 -->|"reads"| DATA
    D3 -->|"reads"| DATA
    D4 -->|"reads"| DATA
    D5 -->|"reads"| DATA
    D6 -->|"reads"| DATA
    D7 -->|"reads"| DATA
    D8 -->|"reads"| DATA
    D9 -->|"reads"| DATA
    D10 -->|"reads"| DATA

    D1 -->|"uses"| UTILS
    D2 -->|"uses"| UTILS
    D3 -->|"uses"| UTILS
    D4 -->|"uses"| UTILS
    D5 -->|"uses"| UTILS
    D6 -->|"uses"| UTILS
    D7 -->|"uses"| UTILS
    D8 -->|"uses"| UTILS
    D9 -->|"uses"| UTILS
    D10 -->|"uses"| UTILS

    TEMPLATE -->|"guides"| D1
    TEMPLATE -->|"guides"| D2
    TEMPLATE -->|"guides"| D3
    TEMPLATE -->|"guides"| D4
    TEMPLATE -->|"guides"| D5
    TEMPLATE -->|"guides"| D6
    TEMPLATE -->|"guides"| D7
    TEMPLATE -->|"guides"| D8
    TEMPLATE -->|"guides"| D9
    TEMPLATE -->|"guides"| D10

    classDef code fill:#D0E8FF,stroke:#0366D6,stroke-width:1px;
    classDef data fill:#E6FFE6,stroke:#228B22,stroke-width:1px;
    classDef build fill:#FFE8CC,stroke:#FF8C00,stroke-width:1px;

    click BS "https://github.com/martyjre/advent_of_code_2023/blob/main/build.gradle.kts"
    click CLI "https://github.com/martyjre/advent_of_code_2023/blob/main/build.gradle.kts"
    click D1 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day01.kt"
    click D2 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day02.kt"
    click D3 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day03.kt"
    click D4 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day04.kt"
    click D5 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day05.kt"
    click D6 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day06.kt"
    click D7 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day07.kt"
    click D8 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day08.kt"
    click D9 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day09.kt"
    click D10 "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Day10.kt"
    click TEMPLATE "https://github.com/martyjre/advent_of_code_2023/blob/main/src/DayTemplate.kt"
    click UTILS "https://github.com/martyjre/advent_of_code_2023/blob/main/src/Utils.kt"
    click DATA "https://github.com/martyjre/advent_of_code_2023/tree/main/Days/"
```
