jude253 / Blackjack_simulation

This repository is for code around a blackjack simulation project I am creating. I want to measure the expected returns on varying blackjack strategies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blackjack_simulation

This repository is for code around a blackjack simulation project I am creating. I want to measure the expected returns on varying blackjack strategies.

Current State:

Blackjack_simulation.ipynb

This file is an initial exploration of creating a blackjack simulator. This runs 1,000,000 hands of blackjack played between the dealer and one player. The player uses "basic strategy." "Basic strategy" is hitting when the dealers card is 7 or higher (including ace) until the player hand totals 17 or higher or the player busts. So far I have not added logic for doubling down or splitting (and this is where I believe the player's return can end up being positive). Also, I am collecing a fair amount of data points like the players starting and, dealer's visible card, winner, who busted, etc... I have not done any analysis on this, but I think that could be interesting to look at one day. I think I might eventually move the code in this file to a class in a separate file and use it in different analyses. I need to think more about how I will store the game results to be used in analysis though, if I am going to code up more advanced/experimental strategies. I think it would be cool to eventually train an algorithm to learn the most optimal strategy for Blackjack, and share it with us in human interpretable form. I am just trying to think about what that would be... maybe record optimal first action and starting conditions like: player's hand: (5, 4); dealer's card: 6; optimal first move: double_down and maybe it could even get more advanced like including optimal second move for hands of length 3: player's hand: (5, 4, 3); dealer's card: 2; optimal second move: stay ... I gotta think about this more. Also I am not sure how to make an algorithm that learns by playing a game. I know it's possbile. I'm also not sure if it will actually be worth making that. I doubt that, without counting cards in some way, there is a more much optimal algorithm than using basic strategy and adding some doubling down and splitting in a few scenarios.

About

This repository is for code around a blackjack simulation project I am creating. I want to measure the expected returns on varying blackjack strategies.


Languages

Language:Jupyter Notebook 100.0%