# shyriaievmykola/procedure-pacman architecture

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

- Interactive diagram: https://gitdiagram.com/shyriaievmykola/procedure-pacman
- Repository: https://github.com/shyriaievmykola/procedure-pacman

## Overview

This is a Pygame Pac-Man game with seeded procedural mazes, difficulty selection, ghost behavior, and an interactive presentation layer. The principal workflow runs from the main menu through seed entry and difficulty selection into gameplay, where the game visualizer updates and draws the game and reports victory or game over to the manager. Source excerpts are partial, and the README provides no further capability detail; uncertain runtime links are omitted.

Main entry points: [`game_manager.py`](https://github.com/shyriaievmykola/procedure-pacman/blob/main/game_manager.py) (Game manager), [`visualisation/pacman_visualizer.py`](https://github.com/shyriaievmykola/procedure-pacman/blob/main/visualisation/pacman_visualizer.py) (Game visualizer), [`map/map_generator.py`](https://github.com/shyriaievmykola/procedure-pacman/blob/main/map/map_generator.py) (Map generator), [`ghosts/ghost_manager.py`](https://github.com/shyriaievmykola/procedure-pacman/blob/main/ghosts/ghost_manager.py) (Ghost manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Game flow"]
  node_entry["Program entry<br/>[main.py]"]
  node_manager["Game manager<br/>[game_manager.py]"]
  node_difficulty["Difficulty manager"]
  node_state["Shared state<br/>[state.py]"]
end

subgraph group_maze["Maze generation"]
  node_generator["Map generator<br/>[map_generator.py]"]
  node_game_map["Game map<br/>[game_map.py]"]
  node_seeded_random["Seeded random<br/>[seeded_random.py]"]
end

subgraph group_play["Gameplay"]
  node_pacman["Pac-Man state<br/>[pacman.py]"]
  node_ghost_manager["Ghost manager<br/>[ghost_manager.py]"]
  node_ghost["Ghost entity<br/>[ghost.py]"]
  node_behaviors["Ghost behaviors"]
  node_pathfinding["A-star pathfinding<br/>[pathfinding.py]"]
end

subgraph group_ui["Menus and rendering"]
  node_main_menu["Main menu<br/>[main_menu.py]"]
  node_seed_menu["Seed menu<br/>[game_menu.py]"]
  node_difficulty_menu["Difficulty menu"]
  node_end_menus["Endgame menus"]
  node_map_draw["Map visualization"]
  node_game_draw["Game visualizer"]
  node_base_draw["Base visualizer<br/>[visualizer.py]"]
  node_ghost_draw["Ghost visualizer"]
end

node_player(("Player"))

node_player -->|"starts"| node_entry
node_entry -->|"launches"| node_manager
node_manager -->|"sets instance"| node_state
node_manager -->|"generates maze"| node_generator
node_generator -->|"uses seed"| node_seeded_random
node_generator -->|"creates"| node_game_map
node_manager -->|"handles menu"| node_main_menu
node_manager -->|"handles seed"| node_seed_menu
node_manager -->|"handles choice"| node_difficulty_menu
node_manager -->|"sets level"| node_difficulty
node_manager -->|"handles outcome"| node_end_menus
node_manager -->|"runs gameplay"| node_game_draw
node_seed_menu -->|"draws preview"| node_map_draw
node_game_draw -->|"inherits rendering"| node_base_draw
node_game_draw -->|"reads maze"| node_game_map
node_game_draw -->|"updates and draws"| node_pacman
node_game_draw -->|"updates ghosts"| node_ghost_manager
node_game_draw -->|"draws ghosts"| node_ghost_draw
node_ghost_manager -->|"updates entities"| node_ghost
node_ghost_manager -->|"selects strategies"| node_behaviors
node_ghost -->|"uses paths"| node_pathfinding

click node_entry "https://github.com/shyriaievmykola/procedure-pacman/blob/main/main.py"
click node_manager "https://github.com/shyriaievmykola/procedure-pacman/blob/main/game_manager.py"
click node_difficulty "https://github.com/shyriaievmykola/procedure-pacman/blob/main/difficulty_manager.py"
click node_state "https://github.com/shyriaievmykola/procedure-pacman/blob/main/state.py"
click node_generator "https://github.com/shyriaievmykola/procedure-pacman/blob/main/map/map_generator.py"
click node_game_map "https://github.com/shyriaievmykola/procedure-pacman/blob/main/map/game_map.py"
click node_seeded_random "https://github.com/shyriaievmykola/procedure-pacman/blob/main/seeded_random.py"
click node_main_menu "https://github.com/shyriaievmykola/procedure-pacman/blob/main/menus/main/main_menu.py"
click node_seed_menu "https://github.com/shyriaievmykola/procedure-pacman/blob/main/menus/game/game_menu.py"
click node_difficulty_menu "https://github.com/shyriaievmykola/procedure-pacman/blob/main/menus/main/choose_difficulty.py"
click node_end_menus "https://github.com/shyriaievmykola/procedure-pacman/tree/main/menus/game"
click node_map_draw "https://github.com/shyriaievmykola/procedure-pacman/blob/main/map/map_visualization.py"
click node_game_draw "https://github.com/shyriaievmykola/procedure-pacman/blob/main/visualisation/pacman_visualizer.py"
click node_base_draw "https://github.com/shyriaievmykola/procedure-pacman/blob/main/visualisation/visualizer.py"
click node_ghost_draw "https://github.com/shyriaievmykola/procedure-pacman/blob/main/visualisation/ghost_visualizer.py"
click node_pacman "https://github.com/shyriaievmykola/procedure-pacman/blob/main/pacman.py"
click node_ghost_manager "https://github.com/shyriaievmykola/procedure-pacman/blob/main/ghosts/ghost_manager.py"
click node_ghost "https://github.com/shyriaievmykola/procedure-pacman/blob/main/ghosts/ghost.py"
click node_behaviors "https://github.com/shyriaievmykola/procedure-pacman/tree/main/ghosts/behaviors"
click node_pathfinding "https://github.com/shyriaievmykola/procedure-pacman/blob/main/ghosts/utils/pathfinding.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_manager,node_difficulty,node_state toneBlue
class node_generator,node_game_map,node_seeded_random toneAmber
class node_pacman,node_ghost_manager,node_ghost,node_behaviors,node_pathfinding toneMint
class node_main_menu,node_seed_menu,node_difficulty_menu,node_end_menus,node_map_draw,node_game_draw,node_base_draw,node_ghost_draw toneRose
class node_player toneIndigo
```

## Components

### Game flow

- [Program entry](https://github.com/shyriaievmykola/procedure-pacman/blob/main/main.py): `main.py`
- [Game manager](https://github.com/shyriaievmykola/procedure-pacman/blob/main/game_manager.py): `game_manager.py`
- [Difficulty manager](https://github.com/shyriaievmykola/procedure-pacman/blob/main/difficulty_manager.py): `difficulty_manager.py`
- [Shared state](https://github.com/shyriaievmykola/procedure-pacman/blob/main/state.py): `state.py`

### Maze generation

- [Map generator](https://github.com/shyriaievmykola/procedure-pacman/blob/main/map/map_generator.py): `map/map_generator.py`
- [Game map](https://github.com/shyriaievmykola/procedure-pacman/blob/main/map/game_map.py): `map/game_map.py`
- [Seeded random](https://github.com/shyriaievmykola/procedure-pacman/blob/main/seeded_random.py): `seeded_random.py`

### Gameplay

- [Pac-Man state](https://github.com/shyriaievmykola/procedure-pacman/blob/main/pacman.py): `pacman.py`
- [Ghost manager](https://github.com/shyriaievmykola/procedure-pacman/blob/main/ghosts/ghost_manager.py): `ghosts/ghost_manager.py`
- [Ghost entity](https://github.com/shyriaievmykola/procedure-pacman/blob/main/ghosts/ghost.py): `ghosts/ghost.py`
- [Ghost behaviors](https://github.com/shyriaievmykola/procedure-pacman/tree/main/ghosts/behaviors): `ghosts/behaviors`
- [A-star pathfinding](https://github.com/shyriaievmykola/procedure-pacman/blob/main/ghosts/utils/pathfinding.py): `ghosts/utils/pathfinding.py`

### Menus and rendering

- [Main menu](https://github.com/shyriaievmykola/procedure-pacman/blob/main/menus/main/main_menu.py): `menus/main/main_menu.py`
- [Seed menu](https://github.com/shyriaievmykola/procedure-pacman/blob/main/menus/game/game_menu.py): `menus/game/game_menu.py`
- [Difficulty menu](https://github.com/shyriaievmykola/procedure-pacman/blob/main/menus/main/choose_difficulty.py): `menus/main/choose_difficulty.py`
- [Endgame menus](https://github.com/shyriaievmykola/procedure-pacman/tree/main/menus/game): `menus/game`
- [Map visualization](https://github.com/shyriaievmykola/procedure-pacman/blob/main/map/map_visualization.py): `map/map_visualization.py`
- [Game visualizer](https://github.com/shyriaievmykola/procedure-pacman/blob/main/visualisation/pacman_visualizer.py): `visualisation/pacman_visualizer.py`
- [Base visualizer](https://github.com/shyriaievmykola/procedure-pacman/blob/main/visualisation/visualizer.py): `visualisation/visualizer.py`
- [Ghost visualizer](https://github.com/shyriaievmykola/procedure-pacman/blob/main/visualisation/ghost_visualizer.py): `visualisation/ghost_visualizer.py`

### Other components

- **Player**

## Connections

- Player → Program entry: starts
- Program entry → Game manager: launches
- Game manager → Shared state: sets instance
- Game manager → Map generator: generates maze
- Map generator → Seeded random: uses seed
- Map generator → Game map: creates
- Game manager → Main menu: handles menu
- Game manager → Seed menu: handles seed
- Game manager → Difficulty menu: handles choice
- Game manager → Difficulty manager: sets level
- Game manager → Endgame menus: handles outcome
- Game manager → Game visualizer: runs gameplay
- Seed menu → Map visualization: draws preview
- Game visualizer → Base visualizer: inherits rendering
- Game visualizer → Game map: reads maze
- Game visualizer → Pac-Man state: updates and draws
- Game visualizer → Ghost manager: updates ghosts
- Game visualizer → Ghost visualizer: draws ghosts
- Ghost manager → Ghost entity: updates entities
- Ghost manager → Ghost behaviors: selects strategies
- Ghost entity → A-star pathfinding: uses paths
