# theabry/col333-assignment-3-py2d-fork architecture

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

- Interactive diagram: https://gitdiagram.com/theabry/col333-assignment-3-py2d-fork
- Repository: https://github.com/theabry/col333-assignment-3-py2d-fork

## Overview

This is a Python RoboCup 2D soccer-agent framework: a match runs agents against the soccer server, players interpret each world state, choose a strategy and decision, and emit actions. The main product workflow is the sample player’s strategy/decision path, with specialized play, penalty, movement, and formation capabilities. It also exposes a student-facing policy/runtime framework and replay interface. Some subsystems are documented or indexed but not sampled; their uncertain connections are omitted.

Main entry points: [`src/sample_player_agent.py`](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/sample_player_agent.py) (Sample player agent), [`src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py`](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py) (Goal-kick behavior), [`src/decision_makers/decision_maker.py`](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/decision_makers/decision_maker.py) (Decision router), [`src/behaviors/starter/setplay/bhv_starter_setplay_indirect_freekick.py`](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/setplay/bhv_starter_setplay_indirect_freekick.py) (Indirect free kick)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_match["Match runtime"]
  node_runner["Match runner<br/>[a3.py]"]
  node_rpc["Agent RPC server<br/>[server.py]"]
  node_replay["Replay interface<br/>[play.php]"]
end

subgraph group_player["Player decision"]
  node_player_agent["Sample player agent"]
  node_decision["Decision router<br/>[decision_maker.py]"]
  node_move["Movement decision"]
  node_playon["Play-on decision"]
  node_agent_state["Agent state<br/>[IAgent.py]"]
  node_tools["Soccer calculations<br/>[tools.py]"]
end

subgraph group_behaviors["Soccer behaviors"]
  node_starter_play["Starter set plays"]
  node_placed_ball["Placed-ball behavior"]
  node_clearball["Clear-ball behavior"]
  node_pass["Passing behavior"]
  node_indirect["Indirect free kick"]
  node_goal_kick["Goal-kick behavior"]
  node_penalty["Penalty behavior"]
end

subgraph group_strategy["Position strategy"]
  node_starter_strategy["Starter positioning"]
  node_formation_strategy["Formation positioning"]
  node_formation_file["Formation model<br/>[formation_file.py]"]
  node_player_role["Player roles<br/>[player_role.py]"]
end

subgraph group_student["Student framework"]
  node_student_api["Student action API<br/>[interface.py]"]
  node_student_agent["Student agent entry<br/>[agent.py]"]
  node_student_runtime["Student runtime<br/>[runtime.py]"]
  node_student_policy["Student policy<br/>[policy.py]"]
  node_student_world["World representation<br/>[world.py]"]
  node_student_trace["Decision trace<br/>[trace.py]"]
end

node_coach(("Match operator"))
node_soccer["Soccer server"]

node_coach -->|"starts match"| node_runner
node_runner -->|"runs match against"| node_soccer
node_rpc -->|"dispatches actions"| node_player_agent
node_player_agent -->|"requests decisions"| node_decision
node_player_agent -->|"updates strategy"| node_starter_strategy
node_player_agent -->|"selects strategy"| node_formation_strategy
node_player_agent -->|"inherits state"| node_agent_state
node_decision -->|"routes play"| node_playon
node_decision -->|"routes movement"| node_move
node_move -->|"uses calculations"| node_tools
node_playon -->|"delegates movement"| node_move
node_starter_play -->|"dispatches play"| node_indirect
node_starter_play -->|"dispatches play"| node_goal_kick
node_goal_kick -->|"uses behavior"| node_clearball
node_goal_kick -->|"uses behavior"| node_pass
node_goal_kick -->|"uses behavior"| node_placed_ball
node_indirect -->|"uses behavior"| node_pass
node_indirect -->|"uses behavior"| node_placed_ball
node_formation_strategy -->|"loads formations"| node_formation_file
node_formation_file -->|"uses roles"| node_player_role
node_starter_strategy -->|"uses formation data"| node_formation_file
node_student_agent -->|"exposes interface"| node_student_api
node_student_runtime -->|"invokes agent"| node_student_agent
node_student_policy -->|"records decisions"| node_student_trace
node_student_runtime -.->|"uses world state"| node_student_world
node_replay -.->|"views match replay"| node_soccer

click node_runner "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/a3.py"
click node_rpc "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/server.py"
click node_player_agent "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/sample_player_agent.py"
click node_decision "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/decision_makers/decision_maker.py"
click node_move "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/decision_makers/move_decision_maker.py"
click node_playon "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/decision_makers/play_on_decision_maker.py"
click node_agent_state "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/interfaces/IAgent.py"
click node_tools "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/utils/tools.py"
click node_starter_play "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_setplay.py"
click node_placed_ball "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_go_to_placed_ball.py"
click node_clearball "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_clearball.py"
click node_pass "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_pass.py"
click node_indirect "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/setplay/bhv_starter_setplay_indirect_freekick.py"
click node_goal_kick "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py"
click node_penalty "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_penalty.py"
click node_starter_strategy "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/starter_strategy.py"
click node_formation_strategy "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/formation_strategy.py"
click node_formation_file "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/formation_file.py"
click node_player_role "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/player_role.py"
click node_student_api "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/interface.py"
click node_student_agent "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/agent.py"
click node_student_runtime "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/runtime.py"
click node_student_policy "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/policy.py"
click node_student_world "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/world.py"
click node_student_trace "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/trace.py"
click node_replay "https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/gibbs/play.php"

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_runner,node_rpc,node_replay toneBlue
class node_player_agent,node_decision,node_move,node_playon,node_agent_state,node_tools toneAmber
class node_starter_play,node_placed_ball,node_clearball,node_pass,node_indirect,node_goal_kick,node_penalty,node_soccer toneMint
class node_starter_strategy,node_formation_strategy,node_formation_file,node_player_role toneRose
class node_student_api,node_student_agent,node_student_runtime,node_student_policy,node_student_world,node_student_trace,node_coach toneIndigo
```

## Components

### Match runtime

- [Match runner](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/a3.py): `a3.py`
- [Agent RPC server](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/server.py): `server.py`
- [Replay interface](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/gibbs/play.php): `gibbs/play.php`

### Player decision

- [Sample player agent](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/sample_player_agent.py): `src/sample_player_agent.py`
- [Decision router](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/decision_makers/decision_maker.py): `src/decision_makers/decision_maker.py`
- [Movement decision](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/decision_makers/move_decision_maker.py): `src/decision_makers/move_decision_maker.py`
- [Play-on decision](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/decision_makers/play_on_decision_maker.py): `src/decision_makers/play_on_decision_maker.py`
- [Agent state](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/interfaces/IAgent.py): `src/interfaces/IAgent.py`
- [Soccer calculations](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/utils/tools.py): `src/utils/tools.py`

### Soccer behaviors

- [Starter set plays](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_setplay.py): `src/behaviors/starter/bhv_starter_setplay.py`
- [Placed-ball behavior](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_go_to_placed_ball.py): `src/behaviors/starter/bhv_starter_go_to_placed_ball.py`
- [Clear-ball behavior](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_clearball.py): `src/behaviors/starter/bhv_starter_clearball.py`
- [Passing behavior](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_pass.py): `src/behaviors/starter/bhv_starter_pass.py`
- [Indirect free kick](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/setplay/bhv_starter_setplay_indirect_freekick.py): `src/behaviors/starter/setplay/bhv_starter_setplay_indirect_freekick.py`
- [Goal-kick behavior](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py): `src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py`
- [Penalty behavior](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/behaviors/starter/bhv_starter_penalty.py): `src/behaviors/starter/bhv_starter_penalty.py`

### Position strategy

- [Starter positioning](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/starter_strategy.py): `src/strategy/starter_strategy.py`
- [Formation positioning](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/formation_strategy.py): `src/strategy/formation_strategy.py`
- [Formation model](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/formation_file.py): `src/strategy/formation_file.py`
- [Player roles](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/strategy/player_role.py): `src/strategy/player_role.py`

### Student framework

- [Student action API](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/interface.py): `src/student/interface.py`
- [Student agent entry](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/agent.py): `src/student/agent.py`
- [Student runtime](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/runtime.py): `src/student/framework/runtime.py`
- [Student policy](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/policy.py): `src/student/framework/policy.py`
- [World representation](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/world.py): `src/student/framework/world.py`
- [Decision trace](https://github.com/theabry/col333-assignment-3-py2d-fork/blob/main/src/student/framework/trace.py): `src/student/framework/trace.py`

### Other components

- **Match operator**
- **Soccer server**

## Connections

- Match operator → Match runner: starts match
- Match runner → Soccer server: runs match against
- Agent RPC server → Sample player agent: dispatches actions (evidence: `server.py`)
- Sample player agent → Decision router: requests decisions (evidence: `src/sample_player_agent.py`)
- Sample player agent → Starter positioning: updates strategy (evidence: `src/sample_player_agent.py`)
- Sample player agent → Formation positioning: selects strategy (evidence: `src/sample_player_agent.py`)
- Sample player agent → Agent state: inherits state (evidence: `src/sample_player_agent.py`)
- Decision router → Play-on decision: routes play (evidence: `src/decision_makers/decision_maker.py`)
- Decision router → Movement decision: routes movement (evidence: `src/decision_makers/decision_maker.py`)
- Movement decision → Soccer calculations: uses calculations (evidence: `src/decision_makers/move_decision_maker.py`)
- Play-on decision → Movement decision: delegates movement (evidence: `src/decision_makers/play_on_decision_maker.py`)
- Starter set plays → Indirect free kick: dispatches play (evidence: `src/behaviors/starter/bhv_starter_setplay.py`)
- Starter set plays → Goal-kick behavior: dispatches play (evidence: `src/behaviors/starter/bhv_starter_setplay.py`)
- Goal-kick behavior → Clear-ball behavior: uses behavior (evidence: `src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py`)
- Goal-kick behavior → Passing behavior: uses behavior (evidence: `src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py`)
- Goal-kick behavior → Placed-ball behavior: uses behavior (evidence: `src/behaviors/starter/setplay/bhv_starter_setplay_goal_kick.py`)
- Indirect free kick → Passing behavior: uses behavior (evidence: `src/behaviors/starter/setplay/bhv_starter_setplay_indirect_freekick.py`)
- Indirect free kick → Placed-ball behavior: uses behavior (evidence: `src/behaviors/starter/setplay/bhv_starter_setplay_indirect_freekick.py`)
- Formation positioning → Formation model: loads formations (evidence: `src/strategy/formation_strategy.py`)
- Formation model → Player roles: uses roles (evidence: `src/strategy/formation_file.py`)
- Starter positioning → Formation model: uses formation data (evidence: `src/strategy/starter_strategy.py`)
- Student agent entry → Student action API: exposes interface (evidence: `src/student/agent.py`)
- Student runtime → Student agent entry: invokes agent (evidence: `src/student/framework/runtime.py`)
- Student policy → Decision trace: records decisions (evidence: `src/student/framework/policy.py`)
- Student runtime → World representation: uses world state
- Replay interface → Soccer server: views match replay
