# jhamling/cs-2110-blackjack-project architecture

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

- Interactive diagram: https://gitdiagram.com/jhamling/cs-2110-blackjack-project
- Repository: https://github.com/jhamling/cs-2110-blackjack-project

## Overview

This is a blackjack game and card-counting trainer with a graphical interface and a text-only mode. A player configures a table, places bets, plays hands against the dealer, and reviews results; optional bots play alongside them. The table coordinates dealing, counting, decisions, and settlement. Separate capabilities include count quizzes, bot strategy explanations, edge and expected-value displays, and bots-only simulations. Edges reflect shown imports, calls, or README-documented behavior; several screen implementations and wiring details were not sampled, so uncertain connections are omitted.

Main entry points: [`blackjack/ui/app.py`](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/app.py) (Game app), [`blackjack/game/table.py`](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/table.py) (Round table), [`blackjack/ui/draw.py`](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/draw.py) (Drawing utilities), [`blackjack/players/roster.py`](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/roster.py) (Bot roster)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Game experience"]
  node_app["Game app<br/>[app.py]"]
  node_terminal["Terminal mode<br/>[terminal.py]"]
  node_screens["Game screens"]
end

subgraph group_tableplay["Table gameplay"]
  node_table["Round table<br/>[table.py]"]
  node_shoe["Card shoe<br/>[shoe.py]"]
  node_hand["Player hands<br/>[hand.py]"]
  node_dealer["Dealer play<br/>[dealer.py]"]
  node_betting["Betting and settlement<br/>[betting.py]"]
  node_scores[("Session scores<br/>[scores.py]")]
end

subgraph group_players["Players and strategy"]
  node_roster["Bot roster<br/>[roster.py]"]
  node_mimic["Mimic bot<br/>[mimic_bot.py]"]
  node_basic["Basic strategy bot"]
  node_hilo["Hi-Lo bot<br/>[hilo_bot.py]"]
  node_ko_bot["KO bot<br/>[ko_bot.py]"]
  node_chart["Strategy charts<br/>[strategy_chart.py]"]
end

subgraph group_training["Training and analysis"]
  node_counter["Hi-Lo counter<br/>[counter.py]"]
  node_ko_count["KO count rules<br/>[ko.py]"]
  node_quiz["Count trainer<br/>[count_quiz.py]"]
  node_simulation["Bot simulation<br/>[simulation.py]"]
  node_bot_info["Bot information<br/>[bot_info.py]"]
  node_edge_panel["Edge display<br/>[edge_panel.py]"]
  node_ev_chart["EV chart<br/>[ev_chart.py]"]
end

subgraph group_presentation["Interface presentation"]
  node_count_panel["Count panel<br/>[count_panel.py]"]
  node_decision_view["Bot decision view<br/>[decision_view.py]"]
  node_decision_log["Bot decision log<br/>[decision_log.py]"]
  node_table_view["Table rendering<br/>[table_view.py]"]
  node_draw["Drawing utilities<br/>[draw.py]"]
  node_settings["Display settings<br/>[settings.py]"]
end

node_player(("Player"))

node_player -->|"plays through"| node_app
node_player -->|"plays through"| node_terminal
node_app -->|"uses"| node_table
node_app -->|"uses"| node_quiz
node_app -->|"selects"| node_screens
node_table -->|"deals from"| node_shoe
node_table -->|"updates"| node_counter
node_table -->|"delegates play"| node_dealer
node_table -->|"uses rules"| node_betting
node_table -->|"deals cards"| node_hand
node_table -.->|"seats bots"| node_roster
node_roster -->|"registers"| node_mimic
node_roster -->|"registers"| node_basic
node_roster -->|"registers"| node_hilo
node_roster -->|"registers"| node_ko_bot
node_basic -->|"looks up"| node_chart
node_hilo -->|"extends"| node_basic
node_hilo -->|"uses deviations"| node_chart
node_ko_bot -->|"uses strategy"| node_basic
node_ko_bot -->|"uses count"| node_ko_count
node_counter -->|"supplies tally"| node_ko_count
node_app -.->|"shows count"| node_count_panel
node_app -.->|"shows decisions"| node_decision_view
node_app -.->|"shows log"| node_decision_log
node_app -.->|"shows edge"| node_edge_panel
node_app -.->|"opens"| node_bot_info
node_app -.->|"starts"| node_simulation
node_simulation -->|"runs rounds"| node_table
node_simulation -->|"uses bots"| node_roster
node_app -.->|"offers chart"| node_ev_chart
node_app -.->|"shows saved scores"| node_scores
node_app -.->|"renders table"| node_table_view
node_table_view -->|"draws with"| node_draw
node_count_panel -->|"draws with"| node_draw
node_decision_view -->|"draws with"| node_draw
node_decision_log -->|"draws with"| node_draw
node_edge_panel -->|"draws with"| node_draw
node_ev_chart -->|"draws with"| node_draw
node_draw -->|"reads layout"| node_settings

click node_app "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/app.py"
click node_terminal "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/terminal.py"
click node_screens "https://github.com/jhamling/cs-2110-blackjack-project/tree/main/blackjack/ui/screens"
click node_table "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/table.py"
click node_shoe "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/cards/shoe.py"
click node_hand "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/cards/hand.py"
click node_dealer "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/dealer.py"
click node_betting "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/betting.py"
click node_scores "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/scores.py"
click node_roster "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/roster.py"
click node_mimic "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/mimic_bot.py"
click node_basic "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/basic_strategy_bot.py"
click node_hilo "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/hilo_bot.py"
click node_ko_bot "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/ko_bot.py"
click node_chart "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/strategy_chart.py"
click node_counter "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/counting/counter.py"
click node_ko_count "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/counting/ko.py"
click node_quiz "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/count_quiz.py"
click node_simulation "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/simulation.py"
click node_bot_info "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/screens/bot_info.py"
click node_edge_panel "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/edge_panel.py"
click node_ev_chart "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/ev_chart.py"
click node_count_panel "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/count_panel.py"
click node_decision_view "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/decision_view.py"
click node_decision_log "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/decision_log.py"
click node_table_view "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/table_view.py"
click node_draw "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/draw.py"
click node_settings "https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/settings.py"

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_app,node_terminal,node_screens toneBlue
class node_table,node_shoe,node_hand,node_dealer,node_betting,node_scores toneAmber
class node_roster,node_mimic,node_basic,node_hilo,node_ko_bot,node_chart toneMint
class node_counter,node_ko_count,node_quiz,node_simulation,node_bot_info,node_edge_panel,node_ev_chart toneRose
class node_count_panel,node_decision_view,node_decision_log,node_table_view,node_draw,node_settings,node_player toneIndigo
```

## Components

### Game experience

- [Game app](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/app.py): `blackjack/ui/app.py`
- [Terminal mode](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/terminal.py): `blackjack/ui/terminal.py`
- [Game screens](https://github.com/jhamling/cs-2110-blackjack-project/tree/main/blackjack/ui/screens): `blackjack/ui/screens`

### Table gameplay

- [Round table](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/table.py): `blackjack/game/table.py`
- [Card shoe](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/cards/shoe.py): `blackjack/cards/shoe.py`
- [Player hands](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/cards/hand.py): `blackjack/cards/hand.py`
- [Dealer play](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/dealer.py): `blackjack/game/dealer.py`
- [Betting and settlement](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/betting.py): `blackjack/game/betting.py`
- [Session scores](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/scores.py): `blackjack/game/scores.py`

### Players and strategy

- [Bot roster](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/roster.py): `blackjack/players/roster.py`
- [Mimic bot](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/mimic_bot.py): `blackjack/players/mimic_bot.py`
- [Basic strategy bot](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/basic_strategy_bot.py): `blackjack/players/basic_strategy_bot.py`
- [Hi-Lo bot](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/hilo_bot.py): `blackjack/players/hilo_bot.py`
- [KO bot](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/ko_bot.py): `blackjack/players/ko_bot.py`
- [Strategy charts](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/players/strategy_chart.py): `blackjack/players/strategy_chart.py`

### Training and analysis

- [Hi-Lo counter](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/counting/counter.py): `blackjack/counting/counter.py`
- [KO count rules](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/counting/ko.py): `blackjack/counting/ko.py`
- [Count trainer](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/count_quiz.py): `blackjack/game/count_quiz.py`
- [Bot simulation](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/game/simulation.py): `blackjack/game/simulation.py`
- [Bot information](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/screens/bot_info.py): `blackjack/ui/screens/bot_info.py`
- [Edge display](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/edge_panel.py): `blackjack/ui/edge_panel.py`
- [EV chart](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/ev_chart.py): `blackjack/ui/ev_chart.py`

### Interface presentation

- [Count panel](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/count_panel.py): `blackjack/ui/count_panel.py`
- [Bot decision view](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/decision_view.py): `blackjack/ui/decision_view.py`
- [Bot decision log](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/decision_log.py): `blackjack/ui/decision_log.py`
- [Table rendering](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/table_view.py): `blackjack/ui/table_view.py`
- [Drawing utilities](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/draw.py): `blackjack/ui/draw.py`
- [Display settings](https://github.com/jhamling/cs-2110-blackjack-project/blob/main/blackjack/ui/settings.py): `blackjack/ui/settings.py`

### Other components

- **Player**

## Connections

- Player → Game app: plays through (evidence: `README.md`)
- Player → Terminal mode: plays through (evidence: `README.md`)
- Game app → Round table: uses (evidence: `blackjack/ui/app.py`)
- Game app → Count trainer: uses (evidence: `blackjack/ui/app.py`)
- Game app → Game screens: selects (evidence: `blackjack/ui/app.py`)
- Round table → Card shoe: deals from (evidence: `blackjack/game/table.py`)
- Round table → Hi-Lo counter: updates (evidence: `blackjack/game/table.py`)
- Round table → Dealer play: delegates play (evidence: `blackjack/game/table.py`)
- Round table → Betting and settlement: uses rules (evidence: `blackjack/game/table.py`)
- Round table → Player hands: deals cards (evidence: `blackjack/game/table.py`)
- Round table → Bot roster: seats bots (evidence: `README.md`)
- Bot roster → Mimic bot: registers (evidence: `blackjack/players/roster.py`)
- Bot roster → Basic strategy bot: registers (evidence: `blackjack/players/roster.py`)
- Bot roster → Hi-Lo bot: registers (evidence: `blackjack/players/roster.py`)
- Bot roster → KO bot: registers (evidence: `blackjack/players/roster.py`)
- Basic strategy bot → Strategy charts: looks up (evidence: `blackjack/players/basic_strategy_bot.py`)
- Hi-Lo bot → Basic strategy bot: extends (evidence: `blackjack/players/hilo_bot.py`)
- Hi-Lo bot → Strategy charts: uses deviations (evidence: `blackjack/players/hilo_bot.py`)
- KO bot → Basic strategy bot: uses strategy (evidence: `blackjack/players/ko_bot.py`)
- KO bot → KO count rules: uses count (evidence: `blackjack/players/ko_bot.py`)
- Hi-Lo counter → KO count rules: supplies tally (evidence: `blackjack/counting/ko.py`)
- Game app → Count panel: shows count (evidence: `README.md`)
- Game app → Bot decision view: shows decisions (evidence: `README.md`)
- Game app → Bot decision log: shows log (evidence: `README.md`)
- Game app → Edge display: shows edge (evidence: `README.md`)
- Game app → Bot information: opens (evidence: `README.md`)
- Game app → Bot simulation: starts (evidence: `README.md`)
- Bot simulation → Round table: runs rounds (evidence: `blackjack/game/simulation.py`)
- Bot simulation → Bot roster: uses bots (evidence: `blackjack/game/simulation.py`)
- Game app → EV chart: offers chart (evidence: `README.md`)
- Game app → Session scores: shows saved scores (evidence: `README.md`)
- Game app → Table rendering: renders table (evidence: `README.md`)
- Table rendering → Drawing utilities: draws with (evidence: `blackjack/ui/table_view.py`)
- Count panel → Drawing utilities: draws with (evidence: `blackjack/ui/count_panel.py`)
- Bot decision view → Drawing utilities: draws with (evidence: `blackjack/ui/decision_view.py`)
- Bot decision log → Drawing utilities: draws with (evidence: `blackjack/ui/decision_log.py`)
- Edge display → Drawing utilities: draws with (evidence: `blackjack/ui/edge_panel.py`)
- EV chart → Drawing utilities: draws with (evidence: `blackjack/ui/ev_chart.py`)
- Drawing utilities → Display settings: reads layout (evidence: `blackjack/ui/draw.py`)
