# seokryung/nbdev_cards architecture

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

- Interactive diagram: https://gitdiagram.com/seokryung/nbdev_cards
- Repository: https://github.com/seokryung/nbdev_cards

## Overview

nbdev_cards is a small playing-card library. A user creates a Card, whose suit and rank determine its display and comparison behavior; the library also provides a Deck for card collection operations and a draw_n helper for drawing cards. The deck constructs Card instances and uses Python’s random module to shuffle or select cards. The source excerpts show these runtime relationships; the README specifically documents Card creation, display, and comparison.

Main entry points: [`nbdev_cards/deck.py`](https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/deck.py) (Deck), [`nbdev_cards/card.py`](https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/card.py) (Card API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_card_model["Card model"]
  node_card_values["Suit and rank values<br/>[card.py]"]
  node_card["Card API<br/>[card.py]"]
end

subgraph group_deck_operations["Deck operations"]
  node_deck["Deck<br/>[deck.py]"]
  node_draw_n["draw_n helper<br/>[deck.py]"]
end

node_user(("Library user"))
node_random["Python random"]

node_user -->|"creates and uses"| node_card
node_card -->|"formats with"| node_card_values
node_deck -->|"constructs"| node_card
node_deck -->|"shuffles with"| node_random
node_draw_n -->|"creates and shuffles"| node_deck
node_draw_n -->|"selects with"| node_random

click node_card_values "https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/card.py"
click node_card "https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/card.py"
click node_deck "https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/deck.py"
click node_draw_n "https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/deck.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_card_values,node_card,node_user toneBlue
class node_deck,node_draw_n toneAmber
class node_random toneIndigo
```

## Components

### Card model

- [Suit and rank values](https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/card.py): `nbdev_cards/card.py`
- [Card API](https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/card.py): `nbdev_cards/card.py`

### Deck operations

- [Deck](https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/deck.py): `nbdev_cards/deck.py`
- [draw_n helper](https://github.com/seokryung/nbdev_cards/blob/main/nbdev_cards/deck.py): `nbdev_cards/deck.py`

### Other components

- **Library user**
- **Python random**

## Connections

- Library user → Card API: creates and uses (evidence: `README.md`)
- Card API → Suit and rank values: formats with (evidence: `nbdev_cards/card.py`)
- Deck → Card API: constructs (evidence: `nbdev_cards/deck.py`)
- Deck → Python random: shuffles with (evidence: `nbdev_cards/deck.py`)
- draw_n helper → Deck: creates and shuffles (evidence: `nbdev_cards/deck.py`)
- draw_n helper → Python random: selects with (evidence: `nbdev_cards/deck.py`)
