# bymayanksingh/connect4 architecture

> Architecture diagram of the GitHub repository bymayanksingh/connect4, 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/bymayanksingh/connect4
- Repository: https://github.com/bymayanksingh/connect4

## Overview

##### Main Components Identification

a) Core Game Logic Layer:
- ConnectGame (connect_game.py) - Main game controller
- GameBoard (game_board.py) - Game state and board logic
- GameData (game_data.py) - Data management

b) Presentation Layer:
- GameRenderer (game_renderer.py) - Graphics and sound rendering
- Assets Management (assets.py) - Resource handling

c) Event System:
- Events (events.py) - Event handling and management

d) Configuration:
- Config (config.py) - Game settings and configuration

**[User Input] → [Game Controller (game.py)]**
- ↓
**[Configuration] → [ConnectGame]**
- ↓
- ┌──────────┴──────────┐
- ↓                     ↓
- [Game Logic]          [Presentation]
- GameBoard           - GameRenderer
- GameData           - Assets Manager
- ↑                     ↑
- ┬──────────┘
- ↓
- [Event System]
- ↓
- [Resources (Images/Sounds)]

##### Component Relationships
- How ConnectGame orchestrates the interaction between GameBoard and GameRenderer
- Event flow from user input through the system
- Demonstrate how assets are loaded and utilized by the renderer
- Configuration influence on various components

##### Technical Details
- PyGame as the underlying framework
- File formats for assets (WAV, OGG for sounds, PNG for images)
- Board dimensions (7-column, 6-row grid)

##### Implementation Notes
- Maintain a clear hierarchy of components
- Brief descriptions for each major component

##### Future Expansion Areas
Placeholders for:
- AI Component (planned)
- Network Layer (for multiplayer)
- Theme Customization System
- Cross-platform Support

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        UI[User Input]
    end

    subgraph Core
        GC[Game Controller]:::controller
        CG[ConnectGame]:::core
    end

    subgraph Logic
        GB[GameBoard]:::logic
        GD[GameData]:::logic
    end

    subgraph Presentation
        GR[GameRenderer]:::presentation
        AM[Assets Manager]:::presentation
    end

    subgraph Events
        ES[Event System]:::events
    end

    subgraph Config
        CF[Configuration]:::config
    end

    subgraph Resources
        IR[Image Resources]:::resources
        SR[Sound Resources]:::resources
        DD1[Disc Drop 1]:::resources
        DD2[Disc Drop 2]:::resources
        ES1[Event Sound]:::resources
    end

    UI --> GC
    CF --> CG
    GC --> CG
    CG --> GB
    CG --> GR
    GB --> ES
    GR --> ES
    ES --> AM
    AM --> IR
    AM --> SR
    SR --> DD1
    SR --> DD2
    SR --> ES1

    %% Future Components (dotted)
    subgraph Planned
        AI[AI Component]:::planned
        NL[Network Layer]:::planned
        TC[Theme Customization]:::planned
    end

    %% Styling
    classDef controller fill:#6c8ebf,stroke:#5d7aa9
    classDef core fill:#9673a6,stroke:#7d5d8c
    classDef logic fill:#67ab9f,stroke:#4f8276
    classDef presentation fill:#82b366,stroke:#6d995c
    classDef events fill:#e6a65d,stroke:#b38548
    classDef config fill:#fff2cc,stroke:#d6b656
    classDef resources fill:#f8cecc,stroke:#b85450
    classDef planned fill:#ffffff,stroke:#666666,stroke-dasharray: 5 5

    %% Click Events
    click GC "https://github.com/bymayanksingh/connect4/blob/master/game.py"
    click CG "https://github.com/bymayanksingh/connect4/blob/master/connect_game.py"
    click GB "https://github.com/bymayanksingh/connect4/blob/master/game_board.py"
    click GD "https://github.com/bymayanksingh/connect4/blob/master/game_data.py"
    click GR "https://github.com/bymayanksingh/connect4/blob/master/game_renderer.py"
    click AM "https://github.com/bymayanksingh/connect4/blob/master/assets.py"
    click ES "https://github.com/bymayanksingh/connect4/blob/master/events.py"
    click CF "https://github.com/bymayanksingh/connect4/blob/master/config.py"
    click IR "https://github.com/bymayanksingh/connect4/tree/master/images"
    click SR "https://github.com/bymayanksingh/connect4/tree/master/sounds"
    click DD1 "https://github.com/bymayanksingh/connect4/blob/master/sounds/disc_drop_1.wav"
    click DD2 "https://github.com/bymayanksingh/connect4/blob/master/sounds/disc_drop_2.wav"
    click ES1 "https://github.com/bymayanksingh/connect4/blob/master/sounds/event.ogg"
```
