# khichinho/mdp-blackjack architecture

> Architecture diagram of the GitHub repository khichinho/mdp-blackjack, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khichinho/mdp-blackjack
- Repository: https://github.com/khichinho/mdp-blackjack

## Overview

##### Project type and purpose
- This is an algorithmic/open-source tool (not a full-stack app) for modeling and solving a Blackjack game as a Markov Decision Process (MDP). The README title “MDP-Blackjack” and filenames like Markov.py and Iteration.py point to a simulation/solver framework.

##### File structure
- Top-level Python modules:
- Dealer.py – simulates the dealer (environment dynamics)
- Markov.py – defines states, actions, transition probabilities, rewards
- Iteration.py – implements value or policy iteration over the MDP
- FormatCheck.py – utility to validate input/output data formats
- run.sh – shell script entry point that ties everything together
- .gitignore / LICENSE – project metadata
- No frontend or external services, purely a CLI‐driven MDP solver.

##### Detailed component breakdown
- “FormatCheck.py” (validates inputs)
- “Markov.py” → supplies transitions & rewards
- “Dealer.py” → supplies environment rollouts
- “Iteration.py” → consumes data from Markov.py and Dealer.py, outputs policy/value files

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entrypoint
    run["CLI Entrypoint: run.sh"]:::entry
    run --> python["Python Interpreter\n(Python 3.x)"]:::ext

    %% Modules
    python --> check["Utility Module\nFormatCheck.py"]:::util
    python --> mdp["MDP Definition Module\nMarkov.py"]:::core
    python --> sim["Environment Simulator Module\nDealer.py"]:::core
    python --> solver["MDP Solver Module\nIteration.py"]:::core

    %% Outputs
    solver --> output[(Policy/Value Files\npolicy.csv)]:::data
    solver --> console["Console Output"]:::data

    %% Metadata
    subgraph "Project Metadata"
        license["LICENSE"]:::meta
        gitignore[".gitignore"]:::meta
        readme["README.md"]:::meta
    end

    %% Click Events
    click run "https://github.com/khichinho/mdp-blackjack/blob/master/run.sh"
    click mdp "https://github.com/khichinho/mdp-blackjack/blob/master/Markov.py"
    click solver "https://github.com/khichinho/mdp-blackjack/blob/master/Iteration.py"
    click sim "https://github.com/khichinho/mdp-blackjack/blob/master/Dealer.py"
    click check "https://github.com/khichinho/mdp-blackjack/blob/master/FormatCheck.py"
    click license "https://github.com/khichinho/mdp-blackjack/tree/master/LICENSE"
    click gitignore "https://github.com/khichinho/mdp-blackjack/blob/master/.gitignore"
    click readme "https://github.com/khichinho/mdp-blackjack/blob/master/README.md"

    %% Styles
    classDef entry fill:#FFE599,stroke:#D6B656,stroke-width:2px
    classDef core fill:#C9DAF8,stroke:#6C8EBF,stroke-width:2px
    classDef util fill:#D9EAD3,stroke:#6AA84F,stroke-width:2px
    classDef ext fill:#F4CCCC,stroke:#CC0000,stroke-width:2px
    classDef data fill:#FFF2CC,stroke:#BF9000,stroke-width:2px
    classDef meta fill:#EAD1DC,stroke:#A64D79,stroke-width:2px
```
