# bujin2502/vas architecture

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

- Interactive diagram: https://gitdiagram.com/bujin2502/vas
- Repository: https://github.com/bujin2502/vas

## Overview

This is a single-file, interactive boids simulation: the user starts, stops, resets, or exits a flock whose members move according to alignment, cohesion, separation, and obstacle avoidance. A SPADE agent behaviour updates and draws each boid; the main loop creates agents and handles controls. The README documents Prosody as the XMPP server used for agent accounts. Components and links are based on the sampled boid.py and README; no separate storage or unsampled implementation is indicated.

Main entry points: [`boid.py`](https://github.com/bujin2502/vas/blob/main/boid.py) (Boid motion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Simulation setup"]
  node_main["Simulation loop<br/>[boid.py]"]
  node_controls["Button controls<br/>[boid.py]"]
  node_flock["Flock state<br/>[boid.py]"]
  node_obstacles["Obstacle field<br/>[boid.py]"]
end

subgraph group_motion["Flock behavior"]
  node_boid["Boid motion<br/>[boid.py]"]
  node_alignment["Alignment<br/>[boid.py]"]
  node_cohesion["Cohesion<br/>[boid.py]"]
  node_separation["Separation<br/>[boid.py]"]
  node_avoidance["Obstacle avoidance<br/>[boid.py]"]
end

subgraph group_runtime["Agent and display"]
  node_agent["Boid agent<br/>[boid.py]"]
  node_behavior["Move behaviour<br/>[boid.py]"]
  node_render["Scene rendering<br/>[boid.py]"]
end

node_user(("User"))
node_display["Pygame window"]
node_prosody["Prosody server"]

node_user -->|"clicks"| node_controls
node_controls -->|"sets simulation state"| node_main
node_main -->|"creates and resets"| node_flock
node_main -->|"creates"| node_obstacles
node_main -->|"creates and starts"| node_agent
node_agent -->|"registers"| node_behavior
node_behavior -->|"updates"| node_boid
node_behavior -->|"iterates for drawing"| node_flock
node_behavior -->|"draws"| node_obstacles
node_behavior -->|"draws scene"| node_render
node_render -->|"flips frame"| node_display
node_boid -->|"applies"| node_alignment
node_boid -->|"applies"| node_cohesion
node_boid -->|"applies"| node_separation
node_boid -->|"applies"| node_avoidance
node_avoidance -->|"checks positions"| node_obstacles
node_agent -.->|"connects as XMPP agent"| node_prosody

click node_main "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_controls "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_flock "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_obstacles "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_agent "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_behavior "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_render "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_boid "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_alignment "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_cohesion "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_separation "https://github.com/bujin2502/vas/blob/main/boid.py"
click node_avoidance "https://github.com/bujin2502/vas/blob/main/boid.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_main,node_controls,node_flock,node_obstacles,node_user toneBlue
class node_boid,node_alignment,node_cohesion,node_separation,node_avoidance toneAmber
class node_agent,node_behavior,node_render,node_prosody toneMint
class node_display toneIndigo
```

## Components

### Simulation setup

- [Simulation loop](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Button controls](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Flock state](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Obstacle field](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`

### Flock behavior

- [Boid motion](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Alignment](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Cohesion](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Separation](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Obstacle avoidance](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`

### Agent and display

- [Boid agent](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Move behaviour](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`
- [Scene rendering](https://github.com/bujin2502/vas/blob/main/boid.py): `boid.py`

### Other components

- **User**
- **Pygame window**
- **Prosody server**

## Connections

- User → Button controls: clicks (evidence: `boid.py`)
- Button controls → Simulation loop: sets simulation state (evidence: `boid.py`)
- Simulation loop → Flock state: creates and resets (evidence: `boid.py`)
- Simulation loop → Obstacle field: creates (evidence: `boid.py`)
- Simulation loop → Boid agent: creates and starts (evidence: `boid.py`)
- Boid agent → Move behaviour: registers (evidence: `boid.py`)
- Move behaviour → Boid motion: updates (evidence: `boid.py`)
- Move behaviour → Flock state: iterates for drawing (evidence: `boid.py`)
- Move behaviour → Obstacle field: draws (evidence: `boid.py`)
- Move behaviour → Scene rendering: draws scene (evidence: `boid.py`)
- Scene rendering → Pygame window: flips frame (evidence: `boid.py`)
- Boid motion → Alignment: applies (evidence: `boid.py`)
- Boid motion → Cohesion: applies (evidence: `boid.py`)
- Boid motion → Separation: applies (evidence: `boid.py`)
- Boid motion → Obstacle avoidance: applies (evidence: `boid.py`)
- Obstacle avoidance → Obstacle field: checks positions (evidence: `boid.py`)
- Boid agent → Prosody server: connects as XMPP agent (evidence: `README.md`)
