# heidischieb/eecs581-project1-minesweeper architecture

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

- Interactive diagram: https://gitdiagram.com/heidischieb/eecs581-project1-minesweeper
- Repository: https://github.com/heidischieb/eecs581-project1-minesweeper

## Overview

This is a browser-based Minesweeper game. A player chooses a mine count, starts a round, then reveals or flags cells; the interface displays the updated board, remaining-mine count, and win/loss state. The UI delegates input validation and command dispatch to the input handler, which invokes game rules and board operations. The README documents first-reveal safety, capped flags, flood reveal, and reset behavior. The graph follows shown calls and documented behavior; no backend or persistent store is described.

Main entry points: [`src/UserInterface.tsx`](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/UserInterface.tsx) (Game screen), [`src/types.ts`](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/types.ts) (Game contracts), [`src/inputHandler.ts`](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/inputHandler.ts) (Input validation), [`src/components/SetupControls.tsx`](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/components/SetupControls.tsx) (Setup controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Game interface"]
  node_mount["React mount<br/>[main.tsx]"]
  node_ui["Game screen<br/>[UserInterface.tsx]"]
  node_setup["Setup controls<br/>[SetupControls.tsx]"]
  node_grid["Board controls<br/>[GameBoard.tsx]"]
end

subgraph group_rules["Game commands"]
  node_input["Input validation<br/>[inputHandler.ts]"]
  node_game["Game rules<br/>[gameLogic.ts]"]
end

subgraph group_board["Board operations"]
  node_boardops["Board operations<br/>[boardManager.ts]"]
end

subgraph group_shared["Shared contracts"]
  node_contracts["Game contracts<br/>[types.ts]"]
end

node_player(("Player"))

node_player -->|"chooses mines"| node_setup
node_player -->|"plays cells"| node_grid
node_mount -->|"mounts"| node_ui
node_ui -->|"renders"| node_setup
node_ui -->|"renders"| node_grid
node_setup -->|"submits count"| node_ui
node_grid -->|"sends actions"| node_ui
node_ui -->|"dispatches actions"| node_input
node_input -->|"invokes commands"| node_game
node_game -->|"uses board operations"| node_boardops
node_ui -->|"creates preview"| node_boardops
node_input -->|"validates positions"| node_boardops
node_ui -->|"uses types"| node_contracts
node_setup -->|"uses limits"| node_contracts
node_grid -->|"uses board types"| node_contracts
node_input -->|"uses action types"| node_contracts
node_game -->|"uses state types"| node_contracts
node_boardops -->|"uses board types"| node_contracts

click node_mount "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/main.tsx"
click node_ui "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/UserInterface.tsx"
click node_setup "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/components/SetupControls.tsx"
click node_grid "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/components/GameBoard.tsx"
click node_input "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/inputHandler.ts"
click node_game "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/gameLogic.ts"
click node_boardops "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/boardManager.ts"
click node_contracts "https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/types.ts"

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_mount,node_ui,node_setup,node_grid toneBlue
class node_input,node_game toneAmber
class node_boardops toneMint
class node_contracts toneRose
class node_player toneIndigo
```

## Components

### Game interface

- [React mount](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/main.tsx): `src/main.tsx`
- [Game screen](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/UserInterface.tsx): `src/UserInterface.tsx`
- [Setup controls](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/components/SetupControls.tsx): `src/components/SetupControls.tsx`
- [Board controls](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/components/GameBoard.tsx): `src/components/GameBoard.tsx`

### Game commands

- [Input validation](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/inputHandler.ts): `src/inputHandler.ts`
- [Game rules](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/gameLogic.ts): `src/gameLogic.ts`

### Board operations

- [Board operations](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/boardManager.ts): `src/boardManager.ts`

### Shared contracts

- [Game contracts](https://github.com/heidischieb/eecs581-project1-minesweeper/blob/master/src/types.ts): `src/types.ts`

### Other components

- **Player**

## Connections

- Player → Setup controls: chooses mines (evidence: `README.md`)
- Player → Board controls: plays cells (evidence: `README.md`)
- React mount → Game screen: mounts (evidence: `src/main.tsx`)
- Game screen → Setup controls: renders (evidence: `src/UserInterface.tsx`)
- Game screen → Board controls: renders (evidence: `src/UserInterface.tsx`)
- Setup controls → Game screen: submits count (evidence: `src/components/SetupControls.tsx`)
- Board controls → Game screen: sends actions (evidence: `src/components/GameBoard.tsx`)
- Game screen → Input validation: dispatches actions (evidence: `src/UserInterface.tsx`)
- Input validation → Game rules: invokes commands (evidence: `src/inputHandler.ts`)
- Game rules → Board operations: uses board operations (evidence: `src/gameLogic.ts`)
- Game screen → Board operations: creates preview (evidence: `src/UserInterface.tsx`)
- Input validation → Board operations: validates positions (evidence: `src/inputHandler.ts`)
- Game screen → Game contracts: uses types (evidence: `src/UserInterface.tsx`)
- Setup controls → Game contracts: uses limits (evidence: `src/components/SetupControls.tsx`)
- Board controls → Game contracts: uses board types (evidence: `src/components/GameBoard.tsx`)
- Input validation → Game contracts: uses action types (evidence: `src/inputHandler.ts`)
- Game rules → Game contracts: uses state types (evidence: `src/gameLogic.ts`)
- Board operations → Game contracts: uses board types (evidence: `src/boardManager.ts`)
