Skip to content

AksaRose/Reinforcement_learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

🃏 Reinforcement Learning – Blackjack Agent

This project demonstrates the fundamentals of Reinforcement Learning (RL) by training an agent to play Blackjack, using Gymnasium (formerly OpenAI Gym).

The goal is to teach an agent to make optimal decisions — whether to “hit” or “stick” — to maximize its expected reward in a simulated Blackjack environment.


📘 Project Overview

Blackjack is a simple card game where the player competes against the dealer.
This project implements a Monte Carlo Exploring Starts (MC-ES) algorithm to estimate value functions and derive an optimal strategy for the Blackjack-v1 environment.

The environment models the full game dynamics, including card draws, busts, wins, and losses. The agent learns entirely through simulation and feedback — no prior knowledge of Blackjack rules is required.


##Working (SS)

Screenshot 2025-10-15 at 8 42 35 AM Screenshot 2025-10-15 at 8 42 51 AM

🎯 Learning Objectives

  • Understand state-value and action-value functions (Q(s, a))
  • Implement Monte Carlo Control using Exploring Starts
  • Train an RL agent via episodic sampling
  • Visualize learning progress with 3D plots and policy heatmaps
  • Evaluate convergence and performance

🧩 Tech Stack

Component Description
Language Python 3.10 +
Core Library Gymnasium
Computation & Plotting NumPy, Matplotlib
Notebook Environment Jupyter Notebook
RL Algorithm Monte Carlo Exploring Starts (MC-ES)
Environment Blackjack-v1

🖥️ Running Locally

1️⃣ Clone the Repository

git clone https://github.com/AksaRose/Reinforcement_learning.git
cd Reinforcement_learning

2️⃣ Create a Virtual Environment

python -m venv venv
source venv/bin/activate

Windows:

python -m venv venv
venv\Scripts\activate

3️⃣ Install Dependencies

pip install gymnasium numpy matplotlib jupyter

4️⃣ Launch the Notebook

jupyter notebook Blackjack.ipynb

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published