# wayou/t-rex-runner architecture

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

- Interactive diagram: https://gitdiagram.com/wayou/t-rex-runner
- Repository: https://github.com/wayou/t-rex-runner

## Overview

##### Main components
- Browser UI Layer – represented primarily by index.html which serves as the entry point.
- Presentation Layer – index.css defines the styling and layout.
- Game Logic / Engine – index.js contains the JavaScript game logic controlling animations, mechanics, and interactions.
- Assets – The assets directory (with subdirectories like default_100_percent and default_200_percent) holds images, sprites, and animated GIFs used in the game and promotional screenshots.

##### Determining relationships and interactions
- The browser loads index.html, which links to index.css for styling and index.js for functionality.
- index.js, once executed, dynamically loads assets (images/sprites) to render the game and handle animations/events.
- User interactions (such as key presses) are captured by the game logic (index.js), which updates the game state accordingly and manipulates the DOM (provided by index.html).
- There is no backend service or API, so the communication is entirely within the client side.

##### Highlighting architectural patterns and principles
- Separation of concerns is clearly maintained by splitting HTML (structure), CSS (presentation), and JavaScript (logic).
- The game is designed as a single-page application where all code runs in the client’s browser.
- Although simple, the design can still be mapped as “Input (user interactions) → Game Engine (index.js) → Rendering (DOM updates, CSS styles)” with resource loading.

##### Relevant technologies and frameworks
- HTML, CSS, and JavaScript are the core technologies.
- No external frameworks or libraries are evident from the file tree – the game is self-contained.
- Asset management is handled through organized folders for different resolutions, providing flexibility for different display environments.

##### Essential element details
- That the project follows a front-end-only architecture with a clear separation of concerns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Browser / Client Environment"
        HTML["index.html (Entry Point)"]:::static
        CSS["index.css (Presentation / Styling)"]:::static
        JS["index.js (Game Logic / Engine)"]:::dynamic
        UI["User Input"]:::dynamic
    end

    subgraph "Assets Directory"
        AS["assets"]:::static
        A100["default_100_percent"]:::static
        A200["default_200_percent"]:::static
    end

    HTML -->|"links-to"| CSS
    HTML -->|"includes"| JS
    UI -->|"triggers"| JS
    JS -->|"loads-assets-from"| AS
    AS -->|"contains"| A100
    AS -->|"contains"| A200

    click HTML "https://github.com/wayou/t-rex-runner/blob/gh-pages/index.html"
    click CSS "https://github.com/wayou/t-rex-runner/blob/gh-pages/index.css"
    click JS "https://github.com/wayou/t-rex-runner/blob/gh-pages/index.js"
    click AS "https://github.com/wayou/t-rex-runner/tree/gh-pages/assets"
    click A100 "https://github.com/wayou/t-rex-runner/tree/gh-pages/assets/default_100_percent"
    click A200 "https://github.com/wayou/t-rex-runner/tree/gh-pages/assets/default_200_percent"

    classDef static fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef dynamic fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
```
