# llsourcell/sports_betting_with_reinforcement_learning architecture

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

- Interactive diagram: https://gitdiagram.com/llsourcell/sports_betting_with_reinforcement_learning
- Repository: https://github.com/llsourcell/sports_betting_with_reinforcement_learning

## Overview

This is a small standalone Python implementation of the Gambler’s Problem adapted to sports betting. The runtime initializes a fixed win probability and state tables, repeatedly applies Bellman updates until values converge, then prints the value function. Each update evaluates possible stakes and records the best value and corresponding policy. The README describes running the script, though its example filename differs from the file present in the repository; the graph follows the actual script entry point. Evidence is limited to the README and the single source file.

Main entry points: [`value_iteration_for_sports.py`](https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py) (Convergence loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_script["Script entry point"]
node_parameters["Betting parameters"]
node_solver["Convergence loop"]
node_bellman["Stake evaluator"]
node_tables[("Reward, value, policy")]
node_output["Printed values"]

node_user -->|"runs script"| node_script
node_script -->|"starts"| node_solver
node_solver -->|"updates states"| node_bellman
node_bellman -->|"uses probabilities"| node_parameters
node_bellman -->|"reads and updates"| node_tables
node_solver -->|"checks convergence"| node_tables
node_solver -->|"prints values"| node_output

click node_script "https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py"
click node_parameters "https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py"
click node_solver "https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py"
click node_bellman "https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py"
click node_tables "https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py"
click node_output "https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.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_user toneBlue
class node_script,node_parameters,node_solver,node_bellman,node_output toneTeal
class node_tables toneAmber
```

## Components

### Other components

- **User**
- [Script entry point](https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py): `value_iteration_for_sports.py`
- [Betting parameters](https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py): `value_iteration_for_sports.py`
- [Convergence loop](https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py): `value_iteration_for_sports.py`
- [Stake evaluator](https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py): `value_iteration_for_sports.py`
- [Reward, value, policy](https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py): `value_iteration_for_sports.py`
- [Printed values](https://github.com/llsourcell/sports_betting_with_reinforcement_learning/blob/master/value_iteration_for_sports.py): `value_iteration_for_sports.py`

## Connections

- User → Script entry point: runs script (evidence: `README.md`)
- Script entry point → Convergence loop: starts (evidence: `value_iteration_for_sports.py`)
- Convergence loop → Stake evaluator: updates states (evidence: `value_iteration_for_sports.py`)
- Stake evaluator → Betting parameters: uses probabilities (evidence: `value_iteration_for_sports.py`)
- Stake evaluator → Reward, value, policy: reads and updates (evidence: `value_iteration_for_sports.py`)
- Convergence loop → Reward, value, policy: checks convergence (evidence: `value_iteration_for_sports.py`)
- Convergence loop → Printed values: prints values (evidence: `value_iteration_for_sports.py`)
