# florence-navet/minesweeper architecture

> Architecture diagram of the GitHub repository florence-navet/minesweeper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/florence-navet/minesweeper
- Repository: https://github.com/florence-navet/minesweeper

## Overview

This is a Pygame Minesweeper application: a player launches the main menu, starts a grid game, and on victory may enter a name for a top-three record; settings and the leaderboard are alternate menu flows. The controller coordinates screens, game state, and record persistence. The README also documents difficulty/resolution settings and custom UI. Edges reflect shown imports and calls; source excerpts are partial, so deeper grid rules and unsampled menu behavior are not expanded.

Main entry points: [`controller/menu_controller.py`](https://github.com/florence-navet/minesweeper/blob/main/controller/menu_controller.py) (Screen controller), [`model/data_access.py`](https://github.com/florence-navet/minesweeper/blob/main/model/data_access.py) (Record access), [`model/game_grid.py`](https://github.com/florence-navet/minesweeper/blob/main/model/game_grid.py) (Minesweeper grid), [`model/game_info.py`](https://github.com/florence-navet/minesweeper/blob/main/model/game_info.py) (Game configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screens["Game Screens"]
  node_launcher["Application launch<br/>[main.py]"]
  node_mainmenu["Main menu<br/>[main_menu.py]"]
  node_controller["Screen controller<br/>[menu_controller.py]"]
  node_settings["Settings screen<br/>[settings_menu.py]"]
  node_ingame["In-game display<br/>[in_game_menu.py]"]
  node_victory["Victory screen<br/>[victory_menu.py]"]
  node_recordsview["Leaderboard screen<br/>[roll_of_fame.py]"]
end

subgraph group_game["Game State"]
  node_grid["Minesweeper grid<br/>[game_grid.py]"]
  node_square["Grid squares<br/>[square.py]"]
  node_gameinfo["Game configuration<br/>[game_info.py]"]
end

subgraph group_records["Records"]
  node_data["Record access<br/>[data_access.py]"]
  node_recordfile[("Top-three records<br/>[roll_of_fame.json]")]
end

subgraph group_ui["UI Foundation"]
  node_menus["Menu widgets<br/>[menu.py]"]
  node_interface["Pygame interface<br/>[interface.py]"]
  node_settingsdata["UI and game settings<br/>[__settings__.py]"]
end

node_player(("Player"))

node_player -->|"chooses"| node_mainmenu
node_launcher -->|"starts"| node_mainmenu
node_mainmenu -->|"dispatches screens"| node_controller
node_controller -->|"draws settings"| node_settings
node_controller -->|"draws game"| node_grid
node_controller -->|"draws victory"| node_victory
node_controller -->|"draws leaderboard"| node_recordsview
node_controller -->|"creates state"| node_gameinfo
node_controller -->|"creates access"| node_data
node_grid -->|"creates squares"| node_square
node_grid -->|"inherits display"| node_ingame
node_controller -->|"sets grid"| node_grid
node_grid -->|"updates state"| node_gameinfo
node_controller -->|"checks records"| node_data
node_victory -->|"sets player name"| node_gameinfo
node_controller -->|"saves winner"| node_data
node_recordsview -->|"loads records"| node_data
node_data -->|"reads and writes"| node_recordfile
node_settings -->|"applies difficulty"| node_gameinfo
node_settings -->|"receives access"| node_data
node_mainmenu -->|"inherits widgets"| node_menus
node_settings -->|"inherits widgets"| node_menus
node_victory -->|"inherits widgets"| node_menus
node_recordsview -->|"inherits widgets"| node_menus
node_menus -->|"inherits interface"| node_interface
node_ingame -->|"inherits interface"| node_interface
node_interface -->|"uses constants"| node_settingsdata
node_gameinfo -->|"uses asset paths"| node_settingsdata
node_data -->|"uses record path"| node_settingsdata

click node_launcher "https://github.com/florence-navet/minesweeper/blob/main/main.py"
click node_mainmenu "https://github.com/florence-navet/minesweeper/blob/main/view/main_menu.py"
click node_controller "https://github.com/florence-navet/minesweeper/blob/main/controller/menu_controller.py"
click node_settings "https://github.com/florence-navet/minesweeper/blob/main/view/settings_menu.py"
click node_grid "https://github.com/florence-navet/minesweeper/blob/main/model/game_grid.py"
click node_square "https://github.com/florence-navet/minesweeper/blob/main/model/square.py"
click node_gameinfo "https://github.com/florence-navet/minesweeper/blob/main/model/game_info.py"
click node_ingame "https://github.com/florence-navet/minesweeper/blob/main/view/in_game_menu.py"
click node_victory "https://github.com/florence-navet/minesweeper/blob/main/view/victory_menu.py"
click node_recordsview "https://github.com/florence-navet/minesweeper/blob/main/view/roll_of_fame.py"
click node_data "https://github.com/florence-navet/minesweeper/blob/main/model/data_access.py"
click node_recordfile "https://github.com/florence-navet/minesweeper/blob/main/assets/roll_of_fame.json"
click node_menus "https://github.com/florence-navet/minesweeper/blob/main/view/menu.py"
click node_interface "https://github.com/florence-navet/minesweeper/blob/main/view/interface.py"
click node_settingsdata "https://github.com/florence-navet/minesweeper/blob/main/view/__settings__.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_launcher,node_mainmenu,node_controller,node_settings,node_ingame,node_victory,node_recordsview toneBlue
class node_grid,node_square,node_gameinfo toneAmber
class node_data,node_recordfile toneMint
class node_menus,node_interface,node_settingsdata toneRose
class node_player toneIndigo
```

## Components

### Game Screens

- [Application launch](https://github.com/florence-navet/minesweeper/blob/main/main.py): `main.py`
- [Main menu](https://github.com/florence-navet/minesweeper/blob/main/view/main_menu.py): `view/main_menu.py`
- [Screen controller](https://github.com/florence-navet/minesweeper/blob/main/controller/menu_controller.py): `controller/menu_controller.py`
- [Settings screen](https://github.com/florence-navet/minesweeper/blob/main/view/settings_menu.py): `view/settings_menu.py`
- [In-game display](https://github.com/florence-navet/minesweeper/blob/main/view/in_game_menu.py): `view/in_game_menu.py`
- [Victory screen](https://github.com/florence-navet/minesweeper/blob/main/view/victory_menu.py): `view/victory_menu.py`
- [Leaderboard screen](https://github.com/florence-navet/minesweeper/blob/main/view/roll_of_fame.py): `view/roll_of_fame.py`

### Game State

- [Minesweeper grid](https://github.com/florence-navet/minesweeper/blob/main/model/game_grid.py): `model/game_grid.py`
- [Grid squares](https://github.com/florence-navet/minesweeper/blob/main/model/square.py): `model/square.py`
- [Game configuration](https://github.com/florence-navet/minesweeper/blob/main/model/game_info.py): `model/game_info.py`

### Records

- [Record access](https://github.com/florence-navet/minesweeper/blob/main/model/data_access.py): `model/data_access.py`
- [Top-three records](https://github.com/florence-navet/minesweeper/blob/main/assets/roll_of_fame.json): `assets/roll_of_fame.json`

### UI Foundation

- [Menu widgets](https://github.com/florence-navet/minesweeper/blob/main/view/menu.py): `view/menu.py`
- [Pygame interface](https://github.com/florence-navet/minesweeper/blob/main/view/interface.py): `view/interface.py`
- [UI and game settings](https://github.com/florence-navet/minesweeper/blob/main/view/__settings__.py): `view/__settings__.py`

### Other components

- **Player**

## Connections

- Player → Main menu: chooses (evidence: `README.md`)
- Application launch → Main menu: starts (evidence: `main.py`)
- Main menu → Screen controller: dispatches screens (evidence: `view/main_menu.py`)
- Screen controller → Settings screen: draws settings (evidence: `controller/menu_controller.py`)
- Screen controller → Minesweeper grid: draws game (evidence: `controller/menu_controller.py`)
- Screen controller → Victory screen: draws victory (evidence: `controller/menu_controller.py`)
- Screen controller → Leaderboard screen: draws leaderboard (evidence: `controller/menu_controller.py`)
- Screen controller → Game configuration: creates state (evidence: `controller/menu_controller.py`)
- Screen controller → Record access: creates access (evidence: `controller/menu_controller.py`)
- Minesweeper grid → Grid squares: creates squares (evidence: `model/game_grid.py`)
- Minesweeper grid → In-game display: inherits display (evidence: `model/game_grid.py`)
- Screen controller → Minesweeper grid: sets grid (evidence: `controller/menu_controller.py`)
- Minesweeper grid → Game configuration: updates state (evidence: `model/game_grid.py`)
- Screen controller → Record access: checks records (evidence: `controller/menu_controller.py`)
- Victory screen → Game configuration: sets player name (evidence: `view/victory_menu.py`)
- Screen controller → Record access: saves winner (evidence: `controller/menu_controller.py`)
- Leaderboard screen → Record access: loads records (evidence: `view/roll_of_fame.py`)
- Record access → Top-three records: reads and writes (evidence: `model/data_access.py`)
- Settings screen → Game configuration: applies difficulty (evidence: `view/settings_menu.py`)
- Settings screen → Record access: receives access (evidence: `controller/menu_controller.py`)
- Main menu → Menu widgets: inherits widgets (evidence: `view/main_menu.py`)
- Settings screen → Menu widgets: inherits widgets (evidence: `view/settings_menu.py`)
- Victory screen → Menu widgets: inherits widgets (evidence: `view/victory_menu.py`)
- Leaderboard screen → Menu widgets: inherits widgets (evidence: `view/roll_of_fame.py`)
- Menu widgets → Pygame interface: inherits interface (evidence: `view/menu.py`)
- In-game display → Pygame interface: inherits interface (evidence: `view/in_game_menu.py`)
- Pygame interface → UI and game settings: uses constants (evidence: `view/interface.py`)
- Game configuration → UI and game settings: uses asset paths (evidence: `model/game_info.py`)
- Record access → UI and game settings: uses record path (evidence: `model/data_access.py`)
