# coconutlampshade/homicidal-chauffeur architecture

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

- Interactive diagram: https://gitdiagram.com/coconutlampshade/homicidal-chauffeur
- Repository: https://github.com/coconutlampshade/homicidal-chauffeur

## Overview

##### Main Components

a. Client-Side Components:
- HTML5 Canvas/DOM Interface (for game rendering)
- Game Engine
- Input Controller
- State Manager
- AI Controller (for auto-play features)

##### Component Organization

**User Interface Layer**

**Game Logic Layer**

**State Management Layer**

##### Specific Elements

a. User Interface Components:
- Game Canvas/Display
- Auto-play Controls
- Visual Indicators

b. Game Logic Components:
- Movement Calculator
- Collision Detection
- Turn Manager
- Vehicle Controllers (Squad Car & Crook)

c. State Management:
- Game State
- Player Positions
- Direction States
- Turn Status

##### Interaction Flows

- User input → Input Controller → Game Logic
- Game Logic → State Manager → Display Update
- Auto-play System → Game Logic

##### Important Notes

- Turn-based nature of the system
- Distinction between squad car and crook control systems
- Auto-play feature integration
- Grid system (50x50) representation

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef logic fill:#2ecc71,stroke:#27ae60,color:white
    classDef state fill:#f1c40f,stroke:#f39c12,color:black
    classDef input fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef container fill:none,stroke:#34495e,stroke-width:2px

    %% User Input Layer
    subgraph InputLayer["User Input Layer"]
        KI["Keyboard Input"]:::input
        MI["Mouse Input"]:::input
        AP["Auto-play Controls"]:::input
    end

    %% UI Layer
    subgraph UILayer["User Interface Layer"]
        Canvas["Game Canvas/Display"]:::ui
        Controls["Control Interface"]:::ui
        Indicators["Visual Indicators"]:::ui
    end

    %% Game Logic Layer
    subgraph LogicLayer["Game Logic Layer"]
        GameEngine["Game Engine"]:::logic
        Movement["Movement Calculator"]:::logic
        Collision["Collision Detection"]:::logic
        TurnManager["Turn Manager"]:::logic
        
        subgraph VehicleControllers["Vehicle Controllers"]
            Squad["Squad Car Controller"]:::logic
            Crook["Crook Controller"]:::logic
        end
    end

    %% State Management Layer
    subgraph StateLayer["State Management Layer"]
        GameState["Game State"]:::state
        Positions["Player Positions"]:::state
        Directions["Direction States"]:::state
        TurnStatus["Turn Status"]:::state
    end

    %% Connections
    KI --> Controls
    MI --> Controls
    AP --> GameEngine
    Controls --> GameEngine
    GameEngine --> Movement
    Movement --> Collision
    Collision --> TurnManager
    TurnManager --> VehicleControllers
    Squad --> GameState
    Crook --> GameState
    GameState --> Positions
    GameState --> Directions
    GameState --> TurnStatus
    GameState --> Canvas
    GameState --> Indicators

    %% Click Events
    click Canvas "https://github.com/coconutlampshade/homicidal-chauffeur/blob/main/driver.html"
    click Controls "https://github.com/coconutlampshade/homicidal-chauffeur/blob/main/driver.html"
    click GameEngine "https://github.com/coconutlampshade/homicidal-chauffeur/blob/main/driver.html"
    click Movement "https://github.com/coconutlampshade/homicidal-chauffeur/blob/main/driver.html"
    click Collision "https://github.com/coconutlampshade/homicidal-chauffeur/blob/main/driver.html"
    click GameState "https://github.com/coconutlampshade/homicidal-chauffeur/blob/main/driver.html"

    %% Legend
    subgraph Legend["Legend"]
        UI["UI Components"]:::ui
        LOG["Game Logic"]:::logic
        ST["State Management"]:::state
        IN["User Input"]:::input
    end
```
