# coding-pelican/pacman-c architecture

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

- Interactive diagram: https://gitdiagram.com/coding-pelican/pacman-c
- Repository: https://github.com/coding-pelican/pacman-c

## Overview

##### Component Details

Game Engine (Central Component):
- Sub-components:
- Player Controller
- Ghost AI Controller
- Maze Manager
- Score Manager
- Game State Controller

##### Relationships and Data Flow

- User Input → Game Engine
- Game Engine → Console Renderer
- Game Engine → Audio System
- Game State → Display Manager

##### Technical Implementation Details

Specific technical notes:
- File: pacman.c
- Main game loop
- Game logic
- ASCII rendering
- File: audio_winmm.c
- Windows MM API integration
- Sound effect handling
- File: audio.h
- Audio interface definitions

**[User Input] → [Game Engine] → [Console Display]**
- ↑            ↓    ↓           ↑
- [Game State] [Sound Engine]
- ↓           ↓
- [Input Handler]  [WinMM API]

##### Clear boundaries between system components

This design should capture the essence of a console-based game while highlighting the specific architectural choices made for this ASCII Pacman implementation, particularly its use of the Windows Multimedia API for sound effects and the console-based rendering system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Assets
        AM["Asset Management"]
        BM["Background Music"]
        GE["Game Events Audio"]
        SE["Sound Effects"]
        IA["Intermission Audio"]
        IN["Introduction Audio"]
        
        AM --> BM
        AM --> GE
        AM --> SE
        AM --> IA
        AM --> IN
    end

    subgraph "Core Game Engine"
        GSM["Game State Manager"]
        IH["Input Handler"]
        CD["Collision Detection"]
        SS["Score System"]
        CML["Character Movement Logic"]
        ARE["ASCII Rendering Engine"]
        
        GSM --> IH
        GSM --> CD
        GSM --> SS
        GSM --> CML
        CML --> ARE
    end

    subgraph "Audio System"
        ASI["Audio System Interface"]
        ASW["Audio System Implementation"]
        SFP["Sound Effect Playback"]
        BMM["Background Music Management"]
        
        ASI --> ASW
        ASW --> SFP
        ASW --> BMM
    end

    CO["Console Output"]

    Assets --> ASI
    Assets --> GSM
    ASI <--> GSM
    GSM --> CO

    classDef default fill:#f9f,stroke:#333,stroke-width:2px
    classDef assets fill:#ff9,stroke:#333,stroke-width:2px
    classDef core fill:#99f,stroke:#333,stroke-width:2px
    classDef audio fill:#9f9,stroke:#333,stroke-width:2px
    classDef output fill:#ddd,stroke:#333,stroke-width:2px

    class AM,BM,GE,SE,IA,IN assets
    class GSM,IH,CD,SS,CML,ARE core
    class ASI,ASW,SFP,BMM audio
    class CO output

    click GSM "https://github.com/coding-pelican/pacman-c/blob/main/src/pacman.c"
    click ASI "https://github.com/coding-pelican/pacman-c/blob/main/src/audio.h"
    click ASW "https://github.com/coding-pelican/pacman-c/blob/main/src/audio_winmm.c"
    click AM "https://github.com/coding-pelican/pacman-c/tree/main/Assets/"
```
