# taylorconor/tinytetris architecture

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

- Interactive diagram: https://gitdiagram.com/taylorconor/tinytetris
- Repository: https://github.com/taylorconor/tinytetris

## Overview

##### Project type and purpose
- This is a single-binary, terminal-based C++ game (“tinytetris”) that runs on an 80×23 console. It uses ncurses for screen handling and captures keyboard input to implement Tetris gameplay. There is no frontend/back-end split or network components—this is a standalone CLI application.

##### File structure
- Top-level files only:
- tinytetris.cpp – core source, minified
- tinytetris-commented.cpp – same logic, annotated for readability
- Makefile, LICENSE, README.md – build and documentation
- No subdirectories, no external modules other than the system’s ncurses library.

##### README for additional insights
- Gameplay controls and build instructions are spelled out.
- Dependencies: C++11, curses.h (linked via -lcurses or -lncurses).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Modules"
        GLM["Game Loop Manager"]:::core
        GLE["Game Logic Engine"]:::core
        RDR["Renderer"]:::core
    end

    subgraph "Utility Modules"
        IH["Input Handler"]:::util
        PG["Piece Generator"]:::util
        CD["Collision Detector"]:::util
        ST["Score & Level Tracker"]:::util
    end

    EXT["ncurses / OS (Terminal)"]:::external

    docMakefile["Makefile"]:::doc
    docREADME["README.md"]:::doc
    docLICENSE["LICENSE"]:::doc
    annotated["Annotated Source"]:::doc

    IH -->|"key event"| GLM
    GLM -->|"tick"| GLE
    GLE -->|"state update"| GLE
    GLE -->|"line clear event"| ST
    GLE --> PG
    GLE --> CD
    GLM -->|"draw call"| RDR
    RDR -->|"ncurses calls"| EXT

    click GLM "https://github.com/taylorconor/tinytetris/blob/master/tinytetris.cpp"
    click IH "https://github.com/taylorconor/tinytetris/blob/master/tinytetris.cpp"
    click GLE "https://github.com/taylorconor/tinytetris/blob/master/tinytetris.cpp"
    click PG "https://github.com/taylorconor/tinytetris/blob/master/tinytetris.cpp"
    click CD "https://github.com/taylorconor/tinytetris/blob/master/tinytetris.cpp"
    click RDR "https://github.com/taylorconor/tinytetris/blob/master/tinytetris.cpp"
    click ST "https://github.com/taylorconor/tinytetris/blob/master/tinytetris.cpp"
    click annotated "https://github.com/taylorconor/tinytetris/blob/master/tinytetris-commented.cpp"
    click docMakefile "https://github.com/taylorconor/tinytetris/tree/master/Makefile"
    click docREADME "https://github.com/taylorconor/tinytetris/blob/master/README.md"
    click docLICENSE "https://github.com/taylorconor/tinytetris/tree/master/LICENSE"

    classDef core fill:#D0E8FF,stroke:#0366d6,stroke-width:1px;
    classDef util fill:#E6FFDD,stroke:#28a745,stroke-width:1px;
    classDef external fill:#F0F0F0,stroke:#888888,stroke-width:1px;
    classDef doc fill:#FFF5CC,stroke:#D4A017,stroke-width:1px;
```
