# fullstackjake/duel-circuit architecture

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

- Interactive diagram: https://gitdiagram.com/fullstackjake/duel-circuit
- Repository: https://github.com/fullstackjake/duel-circuit

## Overview

Duel Circuit is an offline, single-player Yu-Gi-Oh! campaign game. The principal loop is campaign progression: choose a circuit match, duel a CPU opponent, earn rewards, improve a collection and deck, then unlock further matches. The engine also supports deck search/import and historical formats, card collecting, replays, tag duels, and presentation/audio features. The map reflects documented capabilities and sampled/indexed engine modules; application-level screen routing and some unsampled subsystem wiring are not shown, so edges are limited to documented or evidenced relationships.

Main entry points: [`src/Ygo.Engine/Campaign/Profile.cs`](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Profile.cs) (Player profile), [`src/Ygo.Engine/Campaign/Library.cs`](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Library.cs) (Campaign circuits), [`src/Ygo.Engine/Duel.cs`](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Duel.cs) (Duel rules engine), [`src/Ygo.Engine/Deck.cs`](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Deck.cs) (Deck model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_campaign["Campaign and economy"]
  node_campaign_progress["Campaign circuits<br/>[Library.cs]"]
  node_brackets["Tournaments<br/>[Brackets.cs]"]
  node_back_alley["Back Alley<br/>[BackAlley.cs]"]
  node_stakes["Ante and stakes<br/>[Ante.cs]"]
  node_profile["Player profile<br/>[Profile.cs]"]
  node_leveling["Rewards and leveling<br/>[Leveling.cs]"]
  node_packs["Booster packs<br/>[Packs.cs]"]
end

subgraph group_dueling["Duel engine"]
  node_duel["Duel rules engine<br/>[Duel.cs]"]
  node_duel_runner["Duel orchestration<br/>[DuelRunner.cs]"]
  node_human_duelist["Human interaction<br/>[HumanDuelist.cs]"]
  node_prompts["Prompt presentation<br/>[PromptPresenter.cs]"]
end

subgraph group_decks["Decks and cards"]
  node_deck["Deck model<br/>[Deck.cs]"]
  node_deck_rules["Deck legality<br/>[DeckRules.cs]"]
  node_card_search["Card search<br/>[CardSearch.cs]"]
  node_printings["Card printings<br/>[Printings.cs]"]
end

subgraph group_experience["Duelist AI"]
  node_ai_personality["Duelist profiles<br/>[Personality.cs]"]
  node_ai_context["Duel context<br/>[DuelContext.cs]"]
  node_playbooks["Deck playbooks<br/>[Playbooks.cs]"]
  node_ai_traits["Card traits<br/>[CardTraits.cs]"]
end

subgraph group_feedback["Presentation and replay"]
  node_replays["Replay system<br/>[Replay.cs]"]
  node_duel_events["Duel presentation<br/>[DuelEvents.cs]"]
  node_audio["Sound effects<br/>[Sfx.cs]"]
end

node_player(("Player"))

node_player -->|"chooses match"| node_campaign_progress
node_campaign_progress -->|"offers tournaments"| node_brackets
node_player -->|"starts duel"| node_duel_runner
node_duel_runner -.->|"runs rules"| node_duel
node_duel_runner -.->|"requests choices"| node_human_duelist
node_human_duelist -->|"presents choices"| node_prompts
node_duel -->|"loads decks"| node_deck
node_duel -->|"supplies state"| node_ai_context
node_ai_context -->|"uses traits"| node_ai_traits
node_ai_personality -.->|"selects strategy"| node_playbooks
node_playbooks -->|"reads deck"| node_deck
node_campaign_progress -->|"records progress"| node_profile
node_brackets -->|"records results"| node_profile
node_campaign_progress -->|"awards experience"| node_leveling
node_leveling -->|"updates rewards"| node_profile
node_profile -->|"opens packs"| node_packs
node_player -->|"searches cards"| node_card_search
node_card_search -->|"uses card traits"| node_ai_traits
node_player -->|"builds deck"| node_deck
node_deck -.->|"checks legality"| node_deck_rules
node_player -->|"stakes cards or DP"| node_back_alley
node_back_alley -->|"settles ante"| node_stakes
node_stakes -.->|"updates collection"| node_profile
node_player -->|"shares replay code"| node_replays
node_duel -.->|"produces duel events"| node_duel_events
node_duel_events -.->|"triggers sound"| node_audio
node_profile -->|"uses printing data"| node_printings

click node_campaign_progress "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Library.cs"
click node_brackets "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Brackets.cs"
click node_back_alley "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/BackAlley.cs"
click node_stakes "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Ante.cs"
click node_profile "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Profile.cs"
click node_leveling "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Leveling.cs"
click node_packs "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Packs.cs"
click node_duel "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Duel.cs"
click node_duel_runner "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/DuelRunner.cs"
click node_human_duelist "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Interactive/HumanDuelist.cs"
click node_prompts "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Interactive/PromptPresenter.cs"
click node_deck "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Deck.cs"
click node_deck_rules "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/DeckBuilding/DeckRules.cs"
click node_card_search "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/DeckBuilding/CardSearch.cs"
click node_printings "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Data/Printings.cs"
click node_ai_personality "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/Personality.cs"
click node_ai_context "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/DuelContext.cs"
click node_playbooks "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/Playbooks/Playbooks.cs"
click node_ai_traits "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/CardTraits.cs"
click node_replays "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Replays/Replay.cs"
click node_duel_events "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Presentation/DuelEvents.cs"
click node_audio "https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Audio/Sfx.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_campaign_progress,node_brackets,node_back_alley,node_stakes,node_profile,node_leveling,node_packs toneBlue
class node_duel,node_duel_runner,node_human_duelist,node_prompts toneAmber
class node_deck,node_deck_rules,node_card_search,node_printings toneMint
class node_ai_personality,node_ai_context,node_playbooks,node_ai_traits toneRose
class node_replays,node_duel_events,node_audio,node_player toneIndigo
```

## Components

### Campaign and economy

- [Campaign circuits](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Library.cs): `src/Ygo.Engine/Campaign/Library.cs`
- [Tournaments](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Brackets.cs): `src/Ygo.Engine/Campaign/Brackets.cs`
- [Back Alley](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/BackAlley.cs): `src/Ygo.Engine/Campaign/BackAlley.cs`
- [Ante and stakes](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Ante.cs): `src/Ygo.Engine/Campaign/Ante.cs`
- [Player profile](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Profile.cs): `src/Ygo.Engine/Campaign/Profile.cs`
- [Rewards and leveling](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Leveling.cs): `src/Ygo.Engine/Campaign/Leveling.cs`
- [Booster packs](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Campaign/Packs.cs): `src/Ygo.Engine/Campaign/Packs.cs`

### Duel engine

- [Duel rules engine](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Duel.cs): `src/Ygo.Engine/Duel.cs`
- [Duel orchestration](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/DuelRunner.cs): `src/Ygo.Engine/DuelRunner.cs`
- [Human interaction](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Interactive/HumanDuelist.cs): `src/Ygo.Engine/Interactive/HumanDuelist.cs`
- [Prompt presentation](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Interactive/PromptPresenter.cs): `src/Ygo.Engine/Interactive/PromptPresenter.cs`

### Decks and cards

- [Deck model](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Deck.cs): `src/Ygo.Engine/Deck.cs`
- [Deck legality](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/DeckBuilding/DeckRules.cs): `src/Ygo.Engine/DeckBuilding/DeckRules.cs`
- [Card search](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/DeckBuilding/CardSearch.cs): `src/Ygo.Engine/DeckBuilding/CardSearch.cs`
- [Card printings](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Data/Printings.cs): `src/Ygo.Engine/Data/Printings.cs`

### Duelist AI

- [Duelist profiles](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/Personality.cs): `src/Ygo.Engine/AI/Personality.cs`
- [Duel context](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/DuelContext.cs): `src/Ygo.Engine/AI/DuelContext.cs`
- [Deck playbooks](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/Playbooks/Playbooks.cs): `src/Ygo.Engine/AI/Playbooks/Playbooks.cs`
- [Card traits](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/AI/CardTraits.cs): `src/Ygo.Engine/AI/CardTraits.cs`

### Presentation and replay

- [Replay system](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Replays/Replay.cs): `src/Ygo.Engine/Replays/Replay.cs`
- [Duel presentation](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Presentation/DuelEvents.cs): `src/Ygo.Engine/Presentation/DuelEvents.cs`
- [Sound effects](https://github.com/fullstackjake/duel-circuit/blob/main/src/Ygo.Engine/Audio/Sfx.cs): `src/Ygo.Engine/Audio/Sfx.cs`

### Other components

- **Player**

## Connections

- Player → Campaign circuits: chooses match
- Campaign circuits → Tournaments: offers tournaments (evidence: `src/Ygo.Engine/Campaign/Library.cs`)
- Player → Duel orchestration: starts duel
- Duel orchestration → Duel rules engine: runs rules
- Duel orchestration → Human interaction: requests choices
- Human interaction → Prompt presentation: presents choices (evidence: `src/Ygo.Engine/Interactive/PromptPresenter.cs`)
- Duel rules engine → Deck model: loads decks (evidence: `src/Ygo.Engine/Duel.cs`)
- Duel rules engine → Duel context: supplies state (evidence: `src/Ygo.Engine/AI/DuelContext.cs`)
- Duel context → Card traits: uses traits (evidence: `src/Ygo.Engine/AI/DuelContext.cs`)
- Duelist profiles → Deck playbooks: selects strategy
- Deck playbooks → Deck model: reads deck (evidence: `src/Ygo.Engine/AI/Playbooks/Playbooks.cs`)
- Campaign circuits → Player profile: records progress (evidence: `src/Ygo.Engine/Campaign/Library.cs`)
- Tournaments → Player profile: records results (evidence: `src/Ygo.Engine/Campaign/Brackets.cs`)
- Campaign circuits → Rewards and leveling: awards experience (evidence: `src/Ygo.Engine/Campaign/Library.cs`)
- Rewards and leveling → Player profile: updates rewards (evidence: `src/Ygo.Engine/Campaign/Leveling.cs`)
- Player profile → Booster packs: opens packs (evidence: `src/Ygo.Engine/Campaign/Profile.cs`)
- Player → Card search: searches cards
- Card search → Card traits: uses card traits (evidence: `src/Ygo.Engine/DeckBuilding/CardSearch.cs`)
- Player → Deck model: builds deck
- Deck model → Deck legality: checks legality
- Player → Back Alley: stakes cards or DP
- Back Alley → Ante and stakes: settles ante (evidence: `src/Ygo.Engine/Campaign/Ante.cs`)
- Ante and stakes → Player profile: updates collection (evidence: `src/Ygo.Engine/Campaign/Ante.cs`)
- Player → Replay system: shares replay code
- Duel rules engine → Duel presentation: produces duel events
- Duel presentation → Sound effects: triggers sound
- Player profile → Card printings: uses printing data (evidence: `src/Ygo.Engine/Campaign/Profile.cs`)
