# nfleig/genetic-algorithm-battle-demo architecture

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

- Interactive diagram: https://gitdiagram.com/nfleig/genetic-algorithm-battle-demo
- Repository: https://github.com/nfleig/genetic-algorithm-battle-demo

## Overview

This Unity demo lets a user adjust two AIs’ settings and observe a battle between their armies. The README describes genetic algorithms as producing strategies and the battle’s outcome, but no source excerpts were provided; therefore, relationships below are limited to those documented capabilities. Script names identify additional runtime components, but their responsibilities and interactions cannot be verified from the available evidence.

Main entry points: [`Assets/Scripts/AI.cs`](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AI.cs) (AI), [`Assets/Scripts/AISettingsManager.cs`](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AISettingsManager.cs) (AI Settings), [`Assets/Scripts/GeneticAlgorithm.cs`](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/GeneticAlgorithm.cs) (Genetic Algorithm), [`Assets/Scripts/GameController.cs`](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/GameController.cs) (Game Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ai["AI Strategy"]
  node_settings_ui["AI Settings"]
  node_setting["Setting<br/>[Setting.cs]"]
  node_ai["AI<br/>[AI.cs]"]
  node_genetics["Genetic Algorithm"]
end

subgraph group_battle["Battle Runtime"]
  node_game["Game Controller<br/>[GameController.cs]"]
  node_fighter["Fighter Controller"]
  node_nexus["Nexus<br/>[Nexus.cs]"]
end

subgraph group_presentation["Presentation"]
  node_camera["Camera Controller"]
  node_label["AI Label<br/>[AILabel.cs]"]
end

node_user(("Player"))

node_user -->|"changes settings"| node_settings_ui
node_settings_ui -->|"configures AIs"| node_ai
node_genetics -->|"produces strategies"| node_ai
node_ai -->|"controls armies"| node_game

click node_settings_ui "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AISettingsManager.cs"
click node_setting "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/Setting.cs"
click node_ai "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AI.cs"
click node_genetics "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/GeneticAlgorithm.cs"
click node_game "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/GameController.cs"
click node_fighter "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/FighterController.cs"
click node_nexus "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/Nexus.cs"
click node_camera "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/CameraController.cs"
click node_label "https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AILabel.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_settings_ui,node_setting,node_ai,node_genetics toneBlue
class node_game,node_fighter,node_nexus toneAmber
class node_camera,node_label toneMint
class node_user toneIndigo
```

## Components

### AI Strategy

- [AI Settings](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AISettingsManager.cs): `Assets/Scripts/AISettingsManager.cs`
- [Setting](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/Setting.cs): `Assets/Scripts/Setting.cs`
- [AI](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AI.cs): `Assets/Scripts/AI.cs`
- [Genetic Algorithm](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/GeneticAlgorithm.cs): `Assets/Scripts/GeneticAlgorithm.cs`

### Battle Runtime

- [Game Controller](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/GameController.cs): `Assets/Scripts/GameController.cs`
- [Fighter Controller](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/FighterController.cs): `Assets/Scripts/FighterController.cs`
- [Nexus](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/Nexus.cs): `Assets/Scripts/Nexus.cs`

### Presentation

- [Camera Controller](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/CameraController.cs): `Assets/Scripts/CameraController.cs`
- [AI Label](https://github.com/nfleig/genetic-algorithm-battle-demo/blob/main/Assets/Scripts/AILabel.cs): `Assets/Scripts/AILabel.cs`

### Other components

- **Player**

## Connections

- Player → AI Settings: changes settings (evidence: `README.md`)
- AI Settings → AI: configures AIs (evidence: `README.md`)
- Genetic Algorithm → AI: produces strategies (evidence: `README.md`)
- AI → Game Controller: controls armies (evidence: `README.md`)
