# jakubmularczyk/projekt_symulacja_miasto architecture

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

- Interactive diagram: https://gitdiagram.com/jakubmularczyk/projekt_symulacja_miasto
- Repository: https://github.com/jakubmularczyk/projekt_symulacja_miasto

## Overview

1. **Project type and runtime**
   - This is a **C++ console simulation** of a medieval city, built around a **turn-based engine**.
   - The repository is organized as a classic layered OO application: **core simulation**, **domain entities**, **managers/services**, **factories**, **random events**, and **tests**.
   - Build system is **CMake** (`CMakeLists.txt`, `CMakeSettings.json`), suggesting a native desktop/server-style executable rather than a web or mobile app.

2. **Top-level architecture**
   - The main runtime path is: **`main.cpp` → `Engine` → `City` and subsystem managers**.
   - The simulation state is split into three main domains:
     - **Population**: citizens and their professions
     - **Buildings**: infrastructure that affects productivity/security
     - **Resources**: food, gold, wood, stone, and likely derived city stats such as health/security
   - This separation makes the code diagram friendly: the engine orchestrates, while managers mutate domain state.

3. **Core simulation loop**
   - The README describes a fixed **turn sequence**:
     1. start new turn
     2. each resident acts
     3. buildings modify citizen efficiency
     4. food is consumed
     5. a random event may occur
     6. health/hunger/security are updated
     7. collapse conditions are checked
     8. a turn report is displayed
   - Architecturally, the engine is the **workflow coordinator**, while the actual logic is delegated to managers and event objects.

4. **City as the central state aggregate**
   - `City` is the main shared state object (`src/core/City.*`), likely holding the current resource pool, population, buildings, and status counters.
   - The city appears to be the **boundary object** between all systems: managers and events operate on it, and the engine reads from it for reports and end-state checks.
   - The collapse rules in the README are city-level constraints:
     - food ≤ 0 for 3 turns
     - gold ≤ 0 for 3 turns
     - security ≤ 0 for 3 turns
   - That implies the city tracks **per-resource failure counters** in addition to raw values.

5. **Population subsystem**
   - The population model is centered on an abstract/base `Citizen` class with concrete professions:
     - `Farmer`, `Guard`, `Merchant`, `Woodcutter`, `Stonecutter`
   - `PopulationManager` likely owns or coordinates the citizen list, triggering each citizen’s turn action and applying city/building effects.
   - `PopulationFactory` creates profession-specific citizens, which keeps creation logic out of the engine and supports extension with new roles.

6. **Building subsystem**
   - Buildings are modeled with a base `Building` class and concrete types such as:
     - `Farm`, `Barracks`, `Marketplace`, `Quarry`, `Sawmill`
   - `BuildingManager` likely stores constructed buildings and applies their modifiers each turn.
   - `BuildingFactory` is the creation boundary for building objects, matching the same extensibility pattern used for population.
   - The presence of both resource-producing and modifier-style buildings suggests the buildings influence either **production rates**, **security**, or **trade efficiency**.

7. **Resource subsystem**
   - `ResourceManager` and `Resources` represent the economic state of the city.
   - Based on the README and class names, resources are probably the shared quantitative layer for:
     - food
     - gold
     - wood
     - stone
     - possibly derived values such as health/security or reserve counters
   - This subsystem is important because it is the **common output/input boundary** for both population actions and events.

8. **Random event subsystem**
   - Random events are modeled as a base `RandomEvent` with concrete event types:
     - `BanditAttackEvent`
     - `DroughtEvent`
     - `FireEvent`
     - `PlagueEvent`
     - `RiotsEvent`
     - `NoEvent`
   - `RandomEventManager` likely selects one event per turn and applies it to the city state.
   - This is a clear plug-in style boundary: events encapsulate transient external shocks without hard-coding them into the engine.

9. **Data flow between subsystems**
   - The main data flow is:
     - **Engine** advances the turn
     - **PopulationManager** invokes individual citizen actions
     - **BuildingManager** applies infrastructure effects
     - **ResourceManager** updates consumables and production outcomes
     - **RandomEventManager** injects stochastic disruptions
     - **City** consolidates the results and checks survival rules
   - This is a mostly **top-down orchestration with shared mutable city state** model, not an event bus or actor system.

10. **Extensibility pattern**
   - The README explicitly says the system is “very easy to extend” through **abstract classes**.
   - The repo structure confirms that pattern:
     - abstract base types in `src/Include`
     - concrete implementations in `src/population`, `src/buildings`, `src/events`
     - factories to decouple construction
   - For an architecture diagram, this means the main extension points are **new citizen types, new building types, and new random events**.

11. **Testing boundary**
   - The `tests/` folder contains unit tests for:
     - citizens
     - city
     - events
     - population manager
     - resource manager
   - This suggests the domain logic is designed to be testable in isolation, especially around turn effects and failure conditions.
   - Tests likely validate the simulation rules rather than UI behavior, since no UI layer appears in the tree.

12. **Repository organization**
   - Headers are centralized under `src/Include`, while implementations are grouped by domain:
     - `src/core`
     - `src/population`
     - `src/buildings`
     - `src/events`
     - `src/factories`
     - `src/managers`
   - That layout reflects the architecture itself: interface/contracts separated from concrete behavior.
   - `config.txt` likely stores initial simulation parameters, matching the README’s note that the user provides starting values before the simulation begins.

Main entry points: [`src/managers/RandomEventManager.cpp`](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/RandomEventManager.cpp) (EventMgr), [`src/core/Engine.cpp`](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/core/Engine.cpp) (Engine), [`src/factories/PopulationFactory.cpp`](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/factories/PopulationFactory.cpp) (PopulationFactory), [`src/factories/BuildingFactory.cpp`](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/factories/BuildingFactory.cpp) (BuildingFactory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_core["Core runtime"]
  node_main["main.cpp<br/>entry point<br/>[main.cpp]"]
  node_engine(("Engine<br/>turn coordinator<br/>[Engine.cpp]"))
  node_city[("City<br/>state aggregate<br/>[City.cpp]")]
  node_logger["Logger<br/>output helper<br/>[Logger.h]"]
end

subgraph group_group_population["Population"]
  node_population_manager(("PopulationMgr<br/>population controller"))
  node_citizen["Citizen<br/>base person<br/>[Citizen.cpp]"]
  node_farmer["Farmer<br/>producer<br/>[Farmer.cpp]"]
  node_guard["Guard<br/>defender<br/>[Guard.cpp]"]
  node_merchant["Merchant<br/>trader<br/>[Merchant.cpp]"]
  node_woodcutter["Woodcutter<br/>gatherer<br/>[Woodcutter.cpp]"]
  node_stonecutter["Stonecutter<br/>gatherer<br/>[Stonecutter.cpp]"]
end

subgraph group_group_buildings["Buildings"]
  node_building_manager(("BuildingMgr<br/>building controller"))
  node_building["Building<br/>base structure<br/>[Building.cpp]"]
  node_farm["Farm<br/>food building<br/>[Farm.cpp]"]
  node_barracks["Barracks<br/>security building<br/>[Barracks.cpp]"]
  node_marketplace["Marketplace<br/>trade building<br/>[Marketplace.cpp]"]
  node_quarry["Quarry<br/>resource building<br/>[Quarry.cpp]"]
  node_sawmill["Sawmill<br/>resource building<br/>[Sawmill.cpp]"]
end

subgraph group_group_resources["Resources"]
  node_resource_manager(("ResourceMgr<br/>economy controller"))
  node_resources[("Resources<br/>resource store<br/>[Resources.h]")]
end

subgraph group_group_events["Events"]
  node_event_manager(("EventMgr<br/>event controller"))
  node_random_event["RandomEvent<br/>base event<br/>[RandomEvent.cpp]"]
  node_bandit_attack["Bandits<br/>attack event"]
  node_drought["Drought<br/>resource event<br/>[DroughtEvent.cpp]"]
  node_fire["Fire<br/>disaster event<br/>[FireEvent.cpp]"]
  node_plague["Plague<br/>health event<br/>[PlagueEvent.cpp]"]
  node_riots["Riots<br/>security event<br/>[RiotsEvent.cpp]"]
  node_no_event["NoEvent<br/>null event<br/>[NoEvent.cpp]"]
end

subgraph group_group_factories["Factories"]
  node_population_factory{{"PopulationFactory<br/>creator"}}
  node_building_factory{{"BuildingFactory<br/>creator"}}
end

subgraph group_group_tests["Tests"]
  node_tests_city["City tests<br/>unit tests<br/>[CityTest.cpp]"]
  node_tests_citizen["Citizen tests<br/>unit tests<br/>[CitizenTest.cpp]"]
  node_tests_events["Event tests<br/>unit tests<br/>[EventsTest.cpp]"]
  node_tests_population["Population tests<br/>unit tests"]
end

node_main -->|"starts"| node_engine
node_engine -->|"owns state"| node_city
node_engine -->|"turn step"| node_population_manager
node_engine -->|"turn step"| node_building_manager
node_engine -->|"turn step"| node_resource_manager
node_engine -->|"turn step"| node_event_manager
node_engine -->|"reports"| node_logger
node_population_manager -->|"uses base"| node_citizen
node_population_manager -->|"creates"| node_population_factory
node_population_factory -->|"instantiates"| node_farmer
node_population_factory -->|"instantiates"| node_guard
node_population_factory -->|"instantiates"| node_merchant
node_population_factory -->|"instantiates"| node_woodcutter
node_population_factory -->|"instantiates"| node_stonecutter
node_building_manager -->|"uses base"| node_building
node_building_manager -->|"creates"| node_building_factory
node_building_factory -->|"instantiates"| node_farm
node_building_factory -->|"instantiates"| node_barracks
node_building_factory -->|"instantiates"| node_marketplace
node_building_factory -->|"instantiates"| node_quarry
node_building_factory -->|"instantiates"| node_sawmill
node_resource_manager -->|"updates"| node_resources
node_event_manager -->|"uses base"| node_random_event
node_event_manager -->|"chooses"| node_bandit_attack
node_event_manager -->|"chooses"| node_drought
node_event_manager -->|"chooses"| node_fire
node_event_manager -->|"chooses"| node_plague
node_event_manager -->|"chooses"| node_riots
node_event_manager -->|"chooses"| node_no_event
node_tests_city -.->|"covers"| node_city
node_tests_citizen -.->|"covers"| node_citizen
node_tests_events -.->|"covers"| node_event_manager
node_tests_population -.->|"covers"| node_population_manager

click node_main "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/main.cpp"
click node_engine "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/core/Engine.cpp"
click node_city "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/core/City.cpp"
click node_logger "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/Include/Logger.h"
click node_population_manager "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/PopulationManager.cpp"
click node_citizen "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Citizen.cpp"
click node_farmer "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Farmer.cpp"
click node_guard "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Guard.cpp"
click node_merchant "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Merchant.cpp"
click node_woodcutter "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Woodcutter.cpp"
click node_stonecutter "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Stonecutter.cpp"
click node_building_manager "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/BuildingManager.cpp"
click node_building "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Building.cpp"
click node_farm "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Farm.cpp"
click node_barracks "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Barracks.cpp"
click node_marketplace "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Marketplace.cpp"
click node_quarry "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Quarry.cpp"
click node_sawmill "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Sawmill.cpp"
click node_resource_manager "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/ResourceManager.cpp"
click node_resources "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/Include/Resources.h"
click node_event_manager "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/RandomEventManager.cpp"
click node_random_event "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/RandomEvent.cpp"
click node_bandit_attack "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/BanditAttackEvent.cpp"
click node_drought "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/DroughtEvent.cpp"
click node_fire "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/FireEvent.cpp"
click node_plague "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/PlagueEvent.cpp"
click node_riots "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/RiotsEvent.cpp"
click node_no_event "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/NoEvent.cpp"
click node_population_factory "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/factories/PopulationFactory.cpp"
click node_building_factory "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/factories/BuildingFactory.cpp"
click node_tests_city "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/CityTest.cpp"
click node_tests_citizen "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/CitizenTest.cpp"
click node_tests_events "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/EventsTest.cpp"
click node_tests_population "https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/PopulationManagerTest.cpp"

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_engine,node_city,node_logger,node_tests_city,node_tests_citizen,node_tests_events,node_tests_population toneBlue
class node_population_manager,node_citizen,node_farmer,node_guard,node_merchant,node_woodcutter,node_stonecutter toneAmber
class node_building_manager,node_building,node_farm,node_barracks,node_marketplace,node_quarry,node_sawmill toneMint
class node_resource_manager,node_resources toneRose
class node_event_manager,node_random_event,node_bandit_attack,node_drought,node_fire,node_plague,node_riots,node_no_event toneIndigo
class node_population_factory,node_building_factory toneTeal
```

## Components

### Core runtime

Entry point, engine, and shared city state

- [main.cpp](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/main.cpp): entry point · Starts the simulation executable · `src/main.cpp`
- [Engine](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/core/Engine.cpp): turn coordinator · Runs the turn loop and orchestrates subsystem updates · `src/core/Engine.cpp`
- [City](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/core/City.cpp): state aggregate · Central simulation state for population, buildings, resources, and collapse rules · `src/core/City.cpp`
- [Logger](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/Include/Logger.h): output helper · Shared logging/reporting support · `src/Include/Logger.h`

### Population

Citizens and population management

- [PopulationMgr](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/PopulationManager.cpp): population controller · Coordinates resident actions and population-wide updates · `src/managers/PopulationManager.cpp`
- [Citizen](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Citizen.cpp): base person · Abstract citizen behavior shared by all professions · `src/population/Citizen.cpp`
- [Farmer](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Farmer.cpp): producer · Produces food through population actions · `src/population/Farmer.cpp`
- [Guard](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Guard.cpp): defender · Supports city security · `src/population/Guard.cpp`
- [Merchant](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Merchant.cpp): trader · Contributes to gold and trade flow · `src/population/Merchant.cpp`
- [Woodcutter](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Woodcutter.cpp): gatherer · Produces wood · `src/population/Woodcutter.cpp`
- [Stonecutter](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/population/Stonecutter.cpp): gatherer · Produces stone · `src/population/Stonecutter.cpp`

### Buildings

Infrastructure and building management

- [BuildingMgr](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/BuildingManager.cpp): building controller · Stores buildings and applies infrastructure effects · `src/managers/BuildingManager.cpp`
- [Building](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Building.cpp): base structure · Abstract building behavior and shared modifiers · `src/buildings/Building.cpp`
- [Farm](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Farm.cpp): food building · Improves food production · `src/buildings/Farm.cpp`
- [Barracks](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Barracks.cpp): security building · Improves defense and security · `src/buildings/Barracks.cpp`
- [Marketplace](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Marketplace.cpp): trade building · Improves economic efficiency · `src/buildings/Marketplace.cpp`
- [Quarry](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Quarry.cpp): resource building · Supports stone production · `src/buildings/Quarry.cpp`
- [Sawmill](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/buildings/Sawmill.cpp): resource building · Supports wood production · `src/buildings/Sawmill.cpp`

### Resources

Economic state and resource updates

- [ResourceMgr](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/ResourceManager.cpp): economy controller · Updates resources, consumption, and derived city stats · `src/managers/ResourceManager.cpp`
- [Resources](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/Include/Resources.h): resource store · Food, gold, wood, stone, and related city quantities · `src/Include/Resources.h`

### Events

Random event selection and effects

- [EventMgr](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/managers/RandomEventManager.cpp): event controller · Selects and applies a random event each turn · `src/managers/RandomEventManager.cpp`
- [RandomEvent](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/RandomEvent.cpp): base event · Abstract event interface for transient disruptions · `src/events/RandomEvent.cpp`
- [Bandits](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/BanditAttackEvent.cpp): attack event · Threatens gold and security · `src/events/BanditAttackEvent.cpp`
- [Drought](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/DroughtEvent.cpp): resource event · Reduces food availability · `src/events/DroughtEvent.cpp`
- [Fire](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/FireEvent.cpp): disaster event · Damages city resources or structures · `src/events/FireEvent.cpp`
- [Plague](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/PlagueEvent.cpp): health event · Harms population health · `src/events/PlagueEvent.cpp`
- [Riots](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/RiotsEvent.cpp): security event · Destabilizes the city · `src/events/RiotsEvent.cpp`
- [NoEvent](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/events/NoEvent.cpp): null event · Represents a calm turn without disruption · `src/events/NoEvent.cpp`

### Factories

Object creation boundaries

- [PopulationFactory](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/factories/PopulationFactory.cpp): creator · Builds profession-specific citizens · `src/factories/PopulationFactory.cpp`
- [BuildingFactory](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/src/factories/BuildingFactory.cpp): creator · Builds concrete building types · `src/factories/BuildingFactory.cpp`

### Tests

Unit tests for simulation rules

- [City tests](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/CityTest.cpp): unit tests · Validates city state and collapse rules · `tests/CityTest.cpp`
- [Citizen tests](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/CitizenTest.cpp): unit tests · Validates citizen behavior · `tests/CitizenTest.cpp`
- [Event tests](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/EventsTest.cpp): unit tests · Validates event effects and selection · `tests/EventsTest.cpp`
- [Population tests](https://github.com/jakubmularczyk/projekt_symulacja_miasto/blob/main/tests/PopulationManagerTest.cpp): unit tests · Validates population manager turn logic · `tests/PopulationManagerTest.cpp`

## Connections

- main.cpp → Engine: starts · Executable hands control to the turn engine
- Engine → City: owns state · Engine advances and inspects the shared city aggregate
- Engine → PopulationMgr: turn step · Runs resident actions each turn
- Engine → BuildingMgr: turn step · Applies infrastructure effects during the turn
- Engine → ResourceMgr: turn step · Updates consumption and resource outcomes
- Engine → EventMgr: turn step · Selects and applies a random event
- Engine → Logger: reports · Produces turn output and status messages
- PopulationMgr → Citizen: uses base · Coordinates the shared citizen abstraction
- PopulationMgr → PopulationFactory: creates · Requests profession-specific citizens
- PopulationFactory → Farmer: instantiates · Creates farmer citizens
- PopulationFactory → Guard: instantiates · Creates guard citizens
- PopulationFactory → Merchant: instantiates · Creates merchant citizens
- PopulationFactory → Woodcutter: instantiates · Creates woodcutter citizens
- PopulationFactory → Stonecutter: instantiates · Creates stonecutter citizens
- BuildingMgr → Building: uses base · Coordinates the shared building abstraction
- BuildingMgr → BuildingFactory: creates · Requests concrete buildings
- BuildingFactory → Farm: instantiates · Creates farm buildings
- BuildingFactory → Barracks: instantiates · Creates barracks buildings
- BuildingFactory → Marketplace: instantiates · Creates marketplace buildings
- BuildingFactory → Quarry: instantiates · Creates quarry buildings
- BuildingFactory → Sawmill: instantiates · Creates sawmill buildings
- ResourceMgr → Resources: updates · Mutates city resources and derived counters
- EventMgr → RandomEvent: uses base · Selects from the event hierarchy
- EventMgr → Bandits: chooses · Can apply a bandit attack
- EventMgr → Drought: chooses · Can apply drought effects
- EventMgr → Fire: chooses · Can apply fire effects
- EventMgr → Plague: chooses · Can apply plague effects
- EventMgr → Riots: chooses · Can apply riots effects
- EventMgr → NoEvent: chooses · Can resolve to no event
- City tests → City: covers · Checks city rules and collapse conditions
- Citizen tests → Citizen: covers · Checks citizen behavior
- Event tests → EventMgr: covers · Checks event selection and effects
- Population tests → PopulationMgr: covers · Checks turn logic and resident actions
