# krishna7123/fruitgridpuzzle architecture

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

- Interactive diagram: https://gitdiagram.com/krishna7123/fruitgridpuzzle
- Repository: https://github.com/krishna7123/fruitgridpuzzle

## Overview

Fruit Grid Puzzle is a Unity grid game: the player uses keyboard or swipe controls to move, collects fruits and avoids bombs, then sees score-based win, draw, or loss feedback. The graph preserves the documented gameplay, counters, restart, and UI capabilities and maps them to source files named in the tree. Since no source excerpts were provided, relationships are limited to README-documented behavior; the UndoManager is shown as a component, but undo is documented as a future improvement.

Main entry points: [`Assets/Scripts/Managers/GameManager.cs`](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/GameManager.cs) (Score and counters), [`Assets/Scripts/Core/GridManager.cs`](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Core/GridManager.cs) (Grid gameplay), [`Assets/Scripts/Input/InputManager.cs`](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Input/InputManager.cs) (Keyboard and swipe), [`Assets/Scripts/Player/PlayerController.cs`](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Player/PlayerController.cs) (Player movement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Player input"]
  node_controls["Keyboard and swipe<br/>[InputManager.cs]"]
  node_controller["Player movement"]
end

subgraph group_gameplay["Grid gameplay"]
  node_grid["Grid gameplay<br/>[GridManager.cs]"]
  node_placement["Fruit and bomb placement<br/>[GridManager.cs]"]
  node_cell["Cell data<br/>[Cell.cs]"]
  node_tile["Tile types<br/>[TileType.cs]"]
end

subgraph group_state["Game state"]
  node_game_manager["Game coordination<br/>[GameManager.cs]"]
  node_game_state["Game state<br/>[GameState.cs]"]
  node_undo["Undo manager<br/>[UndoManager.cs]"]
  node_score["Score and counters<br/>[GameManager.cs]"]
  node_outcome["Win, lose, draw<br/>[GameManager.cs]"]
end

subgraph group_presentation["UI and presentation"]
  node_grid_view["Grid rendering<br/>[GridRenderer.cs]"]
  node_cell_view["Cell display<br/>[CellView.cs]"]
  node_ui["UI and restart<br/>[UIManager.cs]"]
  node_game_over["Game over UI<br/>[GameOverUI.cs]"]
end

node_player(("Player"))

node_player -->|"uses"| node_controls
node_controls -->|"directs movement"| node_controller
node_controller -->|"moves around"| node_grid
node_grid -->|"places randomly"| node_placement
node_player -->|"plays on"| node_grid
node_player -->|"collects fruits"| node_score
node_player -->|"hits bombs"| node_score
node_score -->|"determines result"| node_outcome
node_score -->|"tracks counters"| node_ui
node_outcome -->|"shows result"| node_game_over
node_ui -->|"restarts game"| node_game_manager
node_undo -.->|"supports undo"| node_game_manager

click node_controls "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Input/InputManager.cs"
click node_controller "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Player/PlayerController.cs"
click node_grid "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Core/GridManager.cs"
click node_placement "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Core/GridManager.cs"
click node_cell "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Data/Cell.cs"
click node_tile "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Data/TileType.cs"
click node_game_manager "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/GameManager.cs"
click node_game_state "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Data/GameState.cs"
click node_undo "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/UndoManager.cs"
click node_score "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/GameManager.cs"
click node_outcome "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/GameManager.cs"
click node_grid_view "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/GridRenderer.cs"
click node_cell_view "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/CellView.cs"
click node_ui "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/UIManager.cs"
click node_game_over "https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/GameOverUI.cs"

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_controls,node_controller toneBlue
class node_grid,node_placement,node_cell,node_tile toneAmber
class node_game_manager,node_game_state,node_undo,node_score,node_outcome toneMint
class node_grid_view,node_cell_view,node_ui,node_game_over toneRose
class node_player toneIndigo
```

## Components

### Player input

- [Keyboard and swipe](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Input/InputManager.cs): `Assets/Scripts/Input/InputManager.cs`
- [Player movement](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Player/PlayerController.cs): `Assets/Scripts/Player/PlayerController.cs`

### Grid gameplay

- [Grid gameplay](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Core/GridManager.cs): `Assets/Scripts/Core/GridManager.cs`
- [Fruit and bomb placement](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Core/GridManager.cs): `Assets/Scripts/Core/GridManager.cs`
- [Cell data](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Data/Cell.cs): `Assets/Scripts/Data/Cell.cs`
- [Tile types](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Data/TileType.cs): `Assets/Scripts/Data/TileType.cs`

### Game state

- [Game coordination](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/GameManager.cs): `Assets/Scripts/Managers/GameManager.cs`
- [Game state](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Data/GameState.cs): `Assets/Scripts/Data/GameState.cs`
- [Undo manager](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/UndoManager.cs): `Assets/Scripts/Managers/UndoManager.cs`
- [Score and counters](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/GameManager.cs): `Assets/Scripts/Managers/GameManager.cs`
- [Win, lose, draw](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/Managers/GameManager.cs): `Assets/Scripts/Managers/GameManager.cs`

### UI and presentation

- [Grid rendering](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/GridRenderer.cs): `Assets/Scripts/UI/GridRenderer.cs`
- [Cell display](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/CellView.cs): `Assets/Scripts/UI/CellView.cs`
- [UI and restart](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/UIManager.cs): `Assets/Scripts/UI/UIManager.cs`
- [Game over UI](https://github.com/krishna7123/fruitgridpuzzle/blob/main/Assets/Scripts/UI/GameOverUI.cs): `Assets/Scripts/UI/GameOverUI.cs`

### Other components

- **Player**

## Connections

- Player → Keyboard and swipe: uses (evidence: `README.md`)
- Keyboard and swipe → Player movement: directs movement (evidence: `README.md`)
- Player movement → Grid gameplay: moves around (evidence: `README.md`)
- Grid gameplay → Fruit and bomb placement: places randomly (evidence: `README.md`)
- Player → Grid gameplay: plays on (evidence: `README.md`)
- Player → Score and counters: collects fruits (evidence: `README.md`)
- Player → Score and counters: hits bombs (evidence: `README.md`)
- Score and counters → Win, lose, draw: determines result (evidence: `README.md`)
- Score and counters → UI and restart: tracks counters (evidence: `README.md`)
- Win, lose, draw → Game over UI: shows result (evidence: `README.md`)
- UI and restart → Game coordination: restarts game (evidence: `README.md`)
- Undo manager → Game coordination: supports undo
