# readiz/boj architecture

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

- Interactive diagram: https://gitdiagram.com/readiz/boj
- Repository: https://github.com/readiz/boj

## Overview

##### Main Components

a. Problem Management Layer
- Problem Fetcher (get_problem.mjs)
- Problem Submitter (submit_problem.mjs)
- Problem Storage Structure (/boj directory)

b. Testing Layer
- C++ Test Runner (cpp_test.sh)
- Python Test Runner (py_test.sh)
- JavaScript Test Runner (js_test.sh)

c. Template System
- Language Templates (template.cpp, template.py, template.js, template.rs)

d. Problem Structure
- Problem Directory (contains desc.html, desc.md, input/, output/, solution/)
- Test Cases (input/ and output/ directories)
- Multiple Language Solutions

##### Component Relationships

- Command Line Interface → Problem Management Layer
- Problem Management Layer → Problem Structure
- Testing Layer → Problem Structure
- Template System → Problem Structure

##### Data Flow

Flows:
- User Input → Problem Fetcher → Problem Storage
- Problem Storage → Test Runners → Test Results
- Solution Files → Submit System → Online Judge

##### Special Elements

Features:
- External Dependencies (Chrome, Fonts, X Window)
- Build System Integration
- Test Case Management
- Multi-language Support

**[User Interface Layer]**
- ↓
**[Problem Management Layer]**
- ↓
**[Language Support Layer]**
- ↓
**[Testing & Validation Layer]**
- ↓
**[Storage Layer]**

Key Design Considerations:

##### Automation: Automated testing and submission processes

Technical details:
- WSL2 compatibility requirements
- External dependencies (Chrome, fonts, X Window)
- File system organization
- Testing infrastructure

##### The multi-language support system

This design captures both the technical architecture and the practical workflow of the BOJ problem-solving environment.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph CLI
        UI[Command Line Interface]
    end

    subgraph "Problem Management Layer"
        PF["Problem Fetcher"]:::core
        PS["Problem Submitter"]:::core
        PST["Problem Storage"]:::storage
    end

    subgraph "Language Support Layer"
        subgraph "Template System"
            CPP["C++ Template"]:::template
            PY["Python Template"]:::template
            JS["JavaScript Template"]:::template
            RS["Rust Template"]:::template
        end
    end

    subgraph "Testing Layer"
        CPPT["C++ Test Runner"]:::testing
        PYT["Python Test Runner"]:::testing
        JST["JavaScript Test Runner"]:::testing
    end

    subgraph "Storage Layer"
        subgraph "Problem Structure"
            DESC["Problem Description"]:::storage
            TC["Test Cases"]:::storage
            SOL["Solutions"]:::storage
        end
    end

    subgraph "External Dependencies"
        CHROME["Chrome Browser"]:::external
        FONTS["Fonts"]:::external
        XWIN["X Window"]:::external
    end

    UI --> PF
    UI --> PS
    PF --> PST
    PS --> PST

    PST --> DESC
    PST --> TC
    PST --> SOL

    CPP --> SOL
    PY --> SOL
    JS --> SOL
    RS --> SOL

    TC --> CPPT
    TC --> PYT
    TC --> JST

    CPPT --> SOL
    PYT --> SOL
    JST --> SOL

    %% Click events for component mapping
    click PF "https://github.com/Readiz/BOJ/blob/main/src/get_problem.mjs"
    click PS "https://github.com/Readiz/BOJ/blob/main/src/submit_problem.mjs"
    click PST "https://github.com/Readiz/BOJ/tree/main/boj"
    click CPPT "https://github.com/Readiz/BOJ/blob/main/src/cpp_test.sh"
    click PYT "https://github.com/Readiz/BOJ/blob/main/src/py_test.sh"
    click JST "https://github.com/Readiz/BOJ/blob/main/src/js_test.sh"
    click CPP "https://github.com/Readiz/BOJ/blob/main/src/template.cpp"
    click PY "https://github.com/Readiz/BOJ/blob/main/src/template.py"
    click JS "https://github.com/Readiz/BOJ/blob/main/src/template.js"
    click RS "https://github.com/Readiz/BOJ/blob/main/src/template.rs"
    click DESC "https://github.com/Readiz/BOJ/blob/main/boj/1051/desc.html"
    click TC "https://github.com/Readiz/BOJ/tree/main/boj/1051/input/"
    click SOL "https://github.com/Readiz/BOJ/tree/main/boj/1051/solution/"

    %% Styling
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef testing fill:#4CAF50,stroke:#2E7D32,color:white
    classDef template fill:#FFC107,stroke:#FFA000,color:black
    classDef storage fill:#9E9E9E,stroke:#616161,color:white
    classDef external fill:#F44336,stroke:#C62828,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Testing Components]:::testing
        L3[Template System]:::template
        L4[Storage Components]:::storage
        L5[External Dependencies]:::external
    end
```
