# barnslab/bridge architecture

> Architecture diagram of the GitHub repository barnslab/bridge, 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/barnslab/bridge
- Repository: https://github.com/barnslab/bridge

## Overview

This repository is a modular Godot bridge-game engine. Its principal workflow is mediated by GameManager: it coordinates dealing and player input, keeps private hands outside the referee state, and passes hands to rule validation; GameCore owns public match state and delegates rule checks. The graph also preserves the documented driver and presentation boundaries. Relationships are based on README.md because no source excerpts were supplied; deck variants and network cryptography are described capabilities, but their implementations are not present in the tree.

Main entry points: [`core/game_manager.gd`](https://github.com/barnslab/bridge/blob/main/core/game_manager.gd) (Game manager), [`drivers/player_driver.gd`](https://github.com/barnslab/bridge/blob/main/drivers/player_driver.gd) (Player driver), [`core/rules/base_ruleset.gd`](https://github.com/barnslab/bridge/blob/main/core/rules/base_ruleset.gd) (Base ruleset), [`core/game_core.gd`](https://github.com/barnslab/bridge/blob/main/core/game_core.gd) (Game core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Match orchestration"]
  node_game_manager["Game manager<br/>[game_manager.gd]"]
  node_deck_manager["Deck management"]
end

subgraph group_engine["Rules and state"]
  node_game_core["Game core<br/>[game_core.gd]"]
  node_base_ruleset["Base ruleset<br/>[base_ruleset.gd]"]
  node_standard_ruleset["Standard bridge rules"]
end

subgraph group_model["Shared game data"]
  node_action_params["Action payloads<br/>[action_params.gd]"]
  node_game_event_params["Event payloads"]
  node_bridge_enums["Bridge vocabulary<br/>[bridge_enums.gd]"]
  node_card_resource["Card values<br/>[card_resource.gd]"]
  node_game_data_types["Game data types<br/>[game_data_types.gd]"]
end

subgraph group_adapters["Player and presentation"]
  node_player_driver["Player driver<br/>[player_driver.gd]"]
  node_ui_manager["UI manager<br/>[base_ui_manager.gd]"]
  node_renderer["Renderer<br/>[base_renderer.gd]"]
end

node_game_manager -->|"owns and configures"| node_game_core
node_game_manager -->|"requests deal"| node_deck_manager
node_game_manager -->|"assigns hands, prompts"| node_player_driver
node_game_core -->|"delegates rule checks"| node_base_ruleset
node_game_manager -->|"passes hand for validation"| node_base_ruleset
node_standard_ruleset -->|"implements strategy"| node_base_ruleset
node_player_driver -->|"submits actions"| node_game_manager
node_ui_manager -->|"emits user input"| node_player_driver
node_game_manager -->|"routes events"| node_player_driver

click node_game_manager "https://github.com/barnslab/bridge/blob/main/core/game_manager.gd"
click node_game_core "https://github.com/barnslab/bridge/blob/main/core/game_core.gd"
click node_base_ruleset "https://github.com/barnslab/bridge/blob/main/core/rules/base_ruleset.gd"
click node_standard_ruleset "https://github.com/barnslab/bridge/blob/main/core/rules/standard_bridge_ruleset.gd"
click node_action_params "https://github.com/barnslab/bridge/blob/main/core/data/action_params.gd"
click node_game_event_params "https://github.com/barnslab/bridge/blob/main/core/data/game_event_params.gd"
click node_bridge_enums "https://github.com/barnslab/bridge/blob/main/core/data/bridge_enums.gd"
click node_card_resource "https://github.com/barnslab/bridge/blob/main/core/data/card_resource.gd"
click node_game_data_types "https://github.com/barnslab/bridge/blob/main/core/data/game_data_types.gd"
click node_deck_manager "https://github.com/barnslab/bridge/blob/main/deck/base_deck_manager.gd"
click node_player_driver "https://github.com/barnslab/bridge/blob/main/drivers/player_driver.gd"
click node_ui_manager "https://github.com/barnslab/bridge/blob/main/io/ui/base_ui_manager.gd"
click node_renderer "https://github.com/barnslab/bridge/blob/main/io/renderers/base_renderer.gd"

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_game_manager,node_deck_manager toneBlue
class node_game_core,node_base_ruleset,node_standard_ruleset toneAmber
class node_action_params,node_game_event_params,node_bridge_enums,node_card_resource,node_game_data_types toneMint
class node_player_driver,node_ui_manager,node_renderer toneRose
```

## Components

### Match orchestration

- [Game manager](https://github.com/barnslab/bridge/blob/main/core/game_manager.gd): `core/game_manager.gd`
- [Deck management](https://github.com/barnslab/bridge/blob/main/deck/base_deck_manager.gd): `deck/base_deck_manager.gd`

### Rules and state

- [Game core](https://github.com/barnslab/bridge/blob/main/core/game_core.gd): `core/game_core.gd`
- [Base ruleset](https://github.com/barnslab/bridge/blob/main/core/rules/base_ruleset.gd): `core/rules/base_ruleset.gd`
- [Standard bridge rules](https://github.com/barnslab/bridge/blob/main/core/rules/standard_bridge_ruleset.gd): `core/rules/standard_bridge_ruleset.gd`

### Shared game data

- [Action payloads](https://github.com/barnslab/bridge/blob/main/core/data/action_params.gd): `core/data/action_params.gd`
- [Event payloads](https://github.com/barnslab/bridge/blob/main/core/data/game_event_params.gd): `core/data/game_event_params.gd`
- [Bridge vocabulary](https://github.com/barnslab/bridge/blob/main/core/data/bridge_enums.gd): `core/data/bridge_enums.gd`
- [Card values](https://github.com/barnslab/bridge/blob/main/core/data/card_resource.gd): `core/data/card_resource.gd`
- [Game data types](https://github.com/barnslab/bridge/blob/main/core/data/game_data_types.gd): `core/data/game_data_types.gd`

### Player and presentation

- [Player driver](https://github.com/barnslab/bridge/blob/main/drivers/player_driver.gd): `drivers/player_driver.gd`
- [UI manager](https://github.com/barnslab/bridge/blob/main/io/ui/base_ui_manager.gd): `io/ui/base_ui_manager.gd`
- [Renderer](https://github.com/barnslab/bridge/blob/main/io/renderers/base_renderer.gd): `io/renderers/base_renderer.gd`

## Connections

- Game manager → Game core: owns and configures (evidence: `README.md`)
- Game manager → Deck management: requests deal (evidence: `README.md`)
- Game manager → Player driver: assigns hands, prompts (evidence: `README.md`)
- Game core → Base ruleset: delegates rule checks (evidence: `README.md`)
- Game manager → Base ruleset: passes hand for validation (evidence: `README.md`)
- Standard bridge rules → Base ruleset: implements strategy (evidence: `README.md`)
- Player driver → Game manager: submits actions (evidence: `README.md`)
- UI manager → Player driver: emits user input (evidence: `README.md`)
- Game manager → Player driver: routes events (evidence: `README.md`)
