# victor-lee-123/ai-q-learning-project architecture

> Architecture diagram of the GitHub repository victor-lee-123/ai-q-learning-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/victor-lee-123/ai-q-learning-project
- Repository: https://github.com/victor-lee-123/ai-q-learning-project

## Overview

This Unity project is a Q-learning game demo, documented as a practical reinforcement-learning example and distributed with a runnable ChasingArena build. The apparent user workflow is to launch the arena, observe or interact with an agent, and see training or game information; the README points to a PDF for demo details, but that document and the runtime source were not excerpted. Components below are identified from the project tree and filenames. Dashed, uncited links are tentative, not verified call paths.

Main entry points: [`SourceCode/Assets/Scenes/SampleScene.unity`](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scenes/SampleScene.unity) (Arena scene), [`SourceCode/Assets/Scripts/TrainingManager.cs`](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/TrainingManager.cs) (Training manager), [`SourceCode/Assets/Scripts/AgentController.cs`](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/AgentController.cs) (Learning agent), [`SourceCode/Assets/Prefabs/Agent.prefab`](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Prefabs/Agent.prefab) (Agent prefab)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Arena gameplay"]
  node_agent["Learning agent<br/>[AgentController.cs]"]
  node_agentinfo["Agent state<br/>[AgentInfo.cs]"]
  node_arena["Arena scene<br/>[SampleScene.unity]"]
  node_agentprefab["Agent prefab<br/>[Agent.prefab]"]
  node_floor["Floor prefab<br/>[Floor.prefab]"]
end

subgraph group_learning["Q-learning"]
  node_qtable["Q-table<br/>[QTable.cs]"]
  node_training["Training manager<br/>[TrainingManager.cs]"]
end

subgraph group_presentation["Input and UI"]
  node_player["Player controller"]
  node_ui["Game UI<br/>[UIManager.cs]"]
end

node_human(("Player"))

node_human -.->|"provides input"| node_player
node_player -.->|"interacts with"| node_arena
node_arena -.->|"uses"| node_agentprefab
node_arena -.->|"uses"| node_floor
node_agentprefab -.->|"hosts"| node_agent
node_agent -.->|"uses state"| node_agentinfo
node_training -.->|"trains"| node_agent
node_training -.->|"updates values"| node_qtable
node_ui -.->|"displays status"| node_training

click node_player "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/PlayerController.cs"
click node_agent "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/AgentController.cs"
click node_agentinfo "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/AgentInfo.cs"
click node_arena "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scenes/SampleScene.unity"
click node_agentprefab "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Prefabs/Agent.prefab"
click node_floor "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Prefabs/Floor.prefab"
click node_qtable "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/QTable.cs"
click node_training "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/TrainingManager.cs"
click node_ui "https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/UIManager.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_agent,node_agentinfo,node_arena,node_agentprefab,node_floor toneBlue
class node_qtable,node_training toneAmber
class node_player,node_ui toneMint
class node_human toneIndigo
```

## Components

### Arena gameplay

- [Learning agent](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/AgentController.cs): `SourceCode/Assets/Scripts/AgentController.cs`
- [Agent state](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/AgentInfo.cs): `SourceCode/Assets/Scripts/AgentInfo.cs`
- [Arena scene](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scenes/SampleScene.unity): `SourceCode/Assets/Scenes/SampleScene.unity`
- [Agent prefab](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Prefabs/Agent.prefab): `SourceCode/Assets/Prefabs/Agent.prefab`
- [Floor prefab](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Prefabs/Floor.prefab): `SourceCode/Assets/Prefabs/Floor.prefab`

### Q-learning

- [Q-table](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/QTable.cs): `SourceCode/Assets/Scripts/QTable.cs`
- [Training manager](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/TrainingManager.cs): `SourceCode/Assets/Scripts/TrainingManager.cs`

### Input and UI

- [Player controller](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/PlayerController.cs): `SourceCode/Assets/Scripts/PlayerController.cs`
- [Game UI](https://github.com/victor-lee-123/ai-q-learning-project/blob/main/SourceCode/Assets/Scripts/UIManager.cs): `SourceCode/Assets/Scripts/UIManager.cs`

### Other components

- **Player**

## Connections

- Player → Player controller: provides input
- Player controller → Arena scene: interacts with
- Arena scene → Agent prefab: uses
- Arena scene → Floor prefab: uses
- Agent prefab → Learning agent: hosts
- Learning agent → Agent state: uses state
- Training manager → Learning agent: trains
- Training manager → Q-table: updates values
- Game UI → Training manager: displays status
