# travisbrooks/projecteulercsharp architecture

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

- Interactive diagram: https://gitdiagram.com/travisbrooks/projecteulercsharp
- Repository: https://github.com/travisbrooks/projecteulercsharp

## Overview

##### Main Components

a. Core Framework Layer:
- ISolution Interface (central contract)
- BaseTestRunner (test infrastructure)
- EulerAttribute (problem metadata)

b. Mathematical Library Layer (EulerMath):
- Prime number operations
- Fibonacci sequences
- Permutations
- Factorials
- Figurate numbers
- Fraction operations

c. Problem Implementation Layer:
- Organized by decades (0001s, 0010s, etc.)
- Individual problem solutions
- Decade-specific test runners

d. Support Systems:
- CodeGen (solution generation)
- EulerData (external data files)
- PrettyPrint (output formatting)

- [Problem Implementation Layer]
- ↓
- [Core Framework Layer]
- ↓
- [Mathematical Library Layer]
- ↓
- [Support Systems]

##### Component Relationships

- Problem implementations depending on the ISolution interface
- Test runners extending BaseTestRunner
- Mathematical library usage by problem implementations
- Data flow between components

##### Detailed Elements

For each major component, show:
- Key classes and their relationships
- Data flow directions
- Test coverage integration
- Resource utilization paths

##### The performance measurement system

Key Architectural Patterns to Highlight:
- Template Method pattern in BaseTestRunner
- Strategy pattern for different solution implementations
- Factory pattern for problem instantiation
- Observer pattern for performance monitoring

Remember to include annotations about:
- Performance measurement points
- Test integration points
- Data file access patterns
- Solution generation workflow

This will give other developers a clear understanding of how to:

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#a8d1f0,stroke:#333
    classDef math fill:#90EE90,stroke:#333
    classDef problem fill:#FFE5B4,stroke:#333
    classDef support fill:#D3D3D3,stroke:#333
    classDef test fill:#FFB6C1,stroke:#333

    %% Core Framework Layer
    subgraph CoreFramework
        ISolution["ISolution Interface"]:::core
        BaseTestRunner["Base Test Runner"]:::core
        EulerAttr["Euler Attribute"]:::core
    end

    %% Mathematical Library Layer
    subgraph MathLib
        Primes["Prime Operations"]:::math
        Fibonacci["Fibonacci Sequences"]:::math
        Permutations["Permutations"]:::math
        Factorials["Factorials"]:::math
        FigurateNums["Figurate Numbers"]:::math
        Fractions["Fraction Operations"]:::math
    end

    %% Problem Implementation Layer
    subgraph ProblemImpl
        Decade0001["0001s Problems"]:::problem
        Decade0010["0010s Problems"]:::problem
        Decade0020["0020s Problems"]:::problem
        Decade0030["0030s Problems"]:::problem
        Decade0040["0040s Problems"]:::problem
        Decade0050["0050s Problems"]:::problem
    end

    %% Test Infrastructure
    subgraph TestInfra
        MathTests["Math Library Tests"]:::test
        TestRunner0001["0001s Test Runner"]:::test
        TestRunner0010["0010s Test Runner"]:::test
        TestRunner0020["0020s Test Runner"]:::test
        TestRunner0030["0030s Test Runner"]:::test
        TestRunner0040["0040s Test Runner"]:::test
        TestRunner0050["0050s Test Runner"]:::test
    end

    %% Support Systems
    subgraph Support
        CodeGen["Code Generator"]:::support
        EulerData["External Data Files"]:::support
        PrettyPrint["Pretty Print System"]:::support
    end

    %% Relationships
    ISolution --> BaseTestRunner
    BaseTestRunner --> PrettyPrint
    EulerAttr --> ISolution

    %% Problem Implementation Dependencies
    Decade0001 & Decade0010 & Decade0020 & Decade0030 & Decade0040 & Decade0050 --> ISolution
    Decade0001 & Decade0010 & Decade0020 & Decade0030 & Decade0040 & Decade0050 --> MathLib

    %% Test Runner Relationships
    TestRunner0001 & TestRunner0010 & TestRunner0020 & TestRunner0030 & TestRunner0040 & TestRunner0050 --> BaseTestRunner
    MathTests --> MathLib

    %% Support System Integration
    CodeGen --> ProblemImpl
    EulerData --> ProblemImpl
    
    %% Click Events
    click ISolution "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/ISolution.cs"
    click BaseTestRunner "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/BaseTestRunner.cs"
    click EulerAttr "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerAttribute.cs"
    click Primes "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerMath/Primes.cs"
    click Fibonacci "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerMath/Fibonacci.cs"
    click Permutations "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerMath/Permutations.cs"
    click Factorials "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerMath/Factorial.cs"
    click FigurateNums "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerMath/FigurateNumbers.cs"
    click Fractions "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerMath/Fraction.cs"
    click Decade0001 "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerProblems/0001s/"
    click Decade0010 "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerProblems/0010s/"
    click Decade0020 "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerProblems/0020s/"
    click Decade0030 "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerProblems/0030s/"
    click Decade0040 "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerProblems/0040s/"
    click Decade0050 "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerProblems/0050s/"
    click CodeGen "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/CodeGen/"
    click EulerData "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerData/"
    click PrettyPrint "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/PrettyPrint/"
    click MathTests "https://github.com/TravisBrooks/ProjectEulerCSharp/tree/main/ProjectEulerCSharp/EulerMath/UnitTests/"
    click TestRunner0001 "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerProblems/0001s/TestRunner.cs"
    click TestRunner0010 "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerProblems/0010s/TestRunner.cs"
    click TestRunner0020 "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerProblems/0020s/TestRunner.cs"
    click TestRunner0030 "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerProblems/0030s/TestRunner.cs"
    click TestRunner0040 "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerProblems/0040s/TestRunner.cs"
    click TestRunner0050 "https://github.com/TravisBrooks/ProjectEulerCSharp/blob/main/ProjectEulerCSharp/EulerProblems/0050s/TestRunner.cs"
```
