# m-mirvan/balatro architecture

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

- Interactive diagram: https://gitdiagram.com/m-mirvan/balatro
- Repository: https://github.com/m-mirvan/balatro

## Overview

BalatroConsole is a console-based card-scoring game. The player enters through the program, selects cards in the view model, and plays or discards them; the round manages the hand and deck, while the evaluator identifies a poker-style hand and applies card scoring. The graph preserves the documented card variants and hand types. Relationships are limited to those visible in excerpts, the source index, or the README; the README is empty, so some implementation details remain unshown.

Main entry points: [`BalatroConsole/Scoring/Evaluator.cs`](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Scoring/Evaluator.cs) (Hand evaluator), [`BalatroConsole/Game/Deck.Constructor.cs`](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Deck.Constructor.cs) (Deck construction), [`BalatroConsole/HandTypes/IHandType.cs`](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/IHandType.cs) (Hand type contract), [`BalatroConsole/Game/Round.cs`](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Round.cs) (Round manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Console interaction"]
  node_program["Program entry<br/>[Program.cs]"]
  node_viewmodel["Game view model<br/>[GameViewModel.cs]"]
end

subgraph group_round["Round and cards"]
  node_round["Round manager<br/>[Round.cs]"]
  node_deck["Deck<br/>[Deck.cs]"]
  node_deckbuild["Deck construction"]
  node_hand["Player hand<br/>[Hand.cs]"]
end

subgraph group_rules["Hand evaluation"]
  node_evaluator["Hand evaluator<br/>[Evaluator.cs]"]
  node_handinterface["Hand type contract<br/>[IHandType.cs]"]
  node_flush["Flush rule<br/>[Flush.cs]"]
  node_fullhouse["Full house rule<br/>[FullHouse.cs]"]
  node_three["Three-kind rule<br/>[ThreeOfAKind.cs]"]
  node_pair["Pair rule<br/>[Pair.cs]"]
  node_highcard["High card rule<br/>[HighCard.cs]"]
end

subgraph group_scoring["Scoring model"]
  node_card["Base card<br/>[Card.cs]"]
  node_bonus["Bonus card<br/>[BonusCard.cs]"]
  node_glass["Glass card<br/>[GlassCard.cs]"]
  node_icard["Card interface<br/>[ICard.cs]"]
  node_rank["Card rank<br/>[Rank.cs]"]
  node_suit["Card suit<br/>[Suit.cs]"]
  node_score["Score values<br/>[Score.cs]"]
end

node_player(("Player"))

node_player -->|"starts"| node_program
node_program -->|"runs"| node_viewmodel
node_viewmodel -->|"reads input, renders"| node_player
node_viewmodel -->|"commands, reads state"| node_round
node_round -->|"draws cards"| node_deck
node_round -->|"adds, removes cards"| node_hand
node_round -->|"scores played cards"| node_evaluator
node_deckbuild -->|"initializes"| node_deck
node_deckbuild -->|"creates cards"| node_card
node_deckbuild -->|"creates cards"| node_bonus
node_deckbuild -->|"creates cards"| node_glass
node_deckbuild -->|"uses ranks"| node_rank
node_deckbuild -->|"uses suits"| node_suit
node_evaluator -->|"tests hand"| node_flush
node_evaluator -->|"tests hand"| node_fullhouse
node_evaluator -->|"tests hand"| node_three
node_evaluator -->|"tests hand"| node_pair
node_evaluator -->|"tests hand"| node_highcard
node_flush -->|"implements"| node_handinterface
node_fullhouse -->|"implements"| node_handinterface
node_three -->|"implements"| node_handinterface
node_pair -->|"implements"| node_handinterface
node_highcard -->|"implements"| node_handinterface
node_evaluator -->|"builds score"| node_score
node_evaluator -->|"scores cards"| node_icard
node_card -->|"applies card score"| node_score
node_card -->|"implements"| node_icard
node_bonus -->|"extends"| node_card
node_glass -->|"implements"| node_icard
node_hand -->|"stores cards"| node_icard

click node_program "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Program.cs"
click node_viewmodel "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/ViewModels/GameViewModel.cs"
click node_round "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Round.cs"
click node_deck "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Deck.cs"
click node_deckbuild "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Deck.Constructor.cs"
click node_hand "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Hand.cs"
click node_card "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/Card.cs"
click node_bonus "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/BonusCard.cs"
click node_glass "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/GlassCard.cs"
click node_icard "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/ICard.cs"
click node_rank "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/Rank.cs"
click node_suit "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/Suit.cs"
click node_evaluator "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Scoring/Evaluator.cs"
click node_handinterface "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/IHandType.cs"
click node_flush "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/Flush.cs"
click node_fullhouse "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/FullHouse.cs"
click node_three "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/ThreeOfAKind.cs"
click node_pair "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/Pair.cs"
click node_highcard "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/HighCard.cs"
click node_score "https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Scoring/Score.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_program,node_viewmodel toneBlue
class node_round,node_deck,node_deckbuild,node_hand toneAmber
class node_evaluator,node_handinterface,node_flush,node_fullhouse,node_three,node_pair,node_highcard toneMint
class node_card,node_bonus,node_glass,node_icard,node_rank,node_suit,node_score toneRose
class node_player toneIndigo
```

## Components

### Console interaction

- [Program entry](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Program.cs): `BalatroConsole/Program.cs`
- [Game view model](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/ViewModels/GameViewModel.cs): `BalatroConsole/ViewModels/GameViewModel.cs`

### Round and cards

- [Round manager](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Round.cs): `BalatroConsole/Game/Round.cs`
- [Deck](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Deck.cs): `BalatroConsole/Game/Deck.cs`
- [Deck construction](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Deck.Constructor.cs): `BalatroConsole/Game/Deck.Constructor.cs`
- [Player hand](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Game/Hand.cs): `BalatroConsole/Game/Hand.cs`

### Hand evaluation

- [Hand evaluator](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Scoring/Evaluator.cs): `BalatroConsole/Scoring/Evaluator.cs`
- [Hand type contract](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/IHandType.cs): `BalatroConsole/HandTypes/IHandType.cs`
- [Flush rule](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/Flush.cs): `BalatroConsole/HandTypes/Flush.cs`
- [Full house rule](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/FullHouse.cs): `BalatroConsole/HandTypes/FullHouse.cs`
- [Three-kind rule](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/ThreeOfAKind.cs): `BalatroConsole/HandTypes/ThreeOfAKind.cs`
- [Pair rule](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/Pair.cs): `BalatroConsole/HandTypes/Pair.cs`
- [High card rule](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/HandTypes/HighCard.cs): `BalatroConsole/HandTypes/HighCard.cs`

### Scoring model

- [Base card](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/Card.cs): `BalatroConsole/Cards/Card.cs`
- [Bonus card](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/BonusCard.cs): `BalatroConsole/Cards/BonusCard.cs`
- [Glass card](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/GlassCard.cs): `BalatroConsole/Cards/GlassCard.cs`
- [Card interface](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/ICard.cs): `BalatroConsole/Cards/ICard.cs`
- [Card rank](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/Rank.cs): `BalatroConsole/Cards/Rank.cs`
- [Card suit](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Cards/Suit.cs): `BalatroConsole/Cards/Suit.cs`
- [Score values](https://github.com/m-mirvan/balatro/blob/master/BalatroConsole/Scoring/Score.cs): `BalatroConsole/Scoring/Score.cs`

### Other components

- **Player**

## Connections

- Player → Program entry: starts (evidence: `BalatroConsole/Program.cs`)
- Program entry → Game view model: runs (evidence: `BalatroConsole/Program.cs`)
- Game view model → Player: reads input, renders (evidence: `BalatroConsole/ViewModels/GameViewModel.cs`)
- Game view model → Round manager: commands, reads state (evidence: `BalatroConsole/ViewModels/GameViewModel.cs`)
- Round manager → Deck: draws cards (evidence: `BalatroConsole/Game/Round.cs`)
- Round manager → Player hand: adds, removes cards (evidence: `BalatroConsole/Game/Round.cs`)
- Round manager → Hand evaluator: scores played cards (evidence: `BalatroConsole/Game/Round.cs`)
- Deck construction → Deck: initializes (evidence: `BalatroConsole/Game/Deck.Constructor.cs`)
- Deck construction → Base card: creates cards (evidence: `BalatroConsole/Game/Deck.Constructor.cs`)
- Deck construction → Bonus card: creates cards (evidence: `BalatroConsole/Game/Deck.Constructor.cs`)
- Deck construction → Glass card: creates cards (evidence: `BalatroConsole/Game/Deck.Constructor.cs`)
- Deck construction → Card rank: uses ranks (evidence: `BalatroConsole/Game/Deck.Constructor.cs`)
- Deck construction → Card suit: uses suits (evidence: `BalatroConsole/Game/Deck.Constructor.cs`)
- Hand evaluator → Flush rule: tests hand (evidence: `BalatroConsole/Scoring/Evaluator.cs`)
- Hand evaluator → Full house rule: tests hand (evidence: `BalatroConsole/Scoring/Evaluator.cs`)
- Hand evaluator → Three-kind rule: tests hand (evidence: `BalatroConsole/Scoring/Evaluator.cs`)
- Hand evaluator → Pair rule: tests hand (evidence: `BalatroConsole/Scoring/Evaluator.cs`)
- Hand evaluator → High card rule: tests hand (evidence: `BalatroConsole/Scoring/Evaluator.cs`)
- Flush rule → Hand type contract: implements (evidence: `BalatroConsole/HandTypes/Flush.cs`)
- Full house rule → Hand type contract: implements (evidence: `BalatroConsole/HandTypes/FullHouse.cs`)
- Three-kind rule → Hand type contract: implements (evidence: `BalatroConsole/HandTypes/ThreeOfAKind.cs`)
- Pair rule → Hand type contract: implements (evidence: `BalatroConsole/HandTypes/Pair.cs`)
- High card rule → Hand type contract: implements (evidence: `BalatroConsole/HandTypes/HighCard.cs`)
- Hand evaluator → Score values: builds score (evidence: `BalatroConsole/Scoring/Evaluator.cs`)
- Hand evaluator → Card interface: scores cards (evidence: `BalatroConsole/Scoring/Evaluator.cs`)
- Base card → Score values: applies card score (evidence: `BalatroConsole/Cards/Card.cs`)
- Base card → Card interface: implements (evidence: `BalatroConsole/Cards/Card.cs`)
- Bonus card → Base card: extends (evidence: `BalatroConsole/Cards/BonusCard.cs`)
- Glass card → Card interface: implements (evidence: `BalatroConsole/Cards/GlassCard.cs`)
- Player hand → Card interface: stores cards (evidence: `BalatroConsole/Game/Hand.cs`)
