Skip to content

NeemaB/Blackjack-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blackjack Simulator

A simple Python console application that allows a user to experiment with various blackjack setups and calculate the expected win/loss ratio of one or more players given a particular setup.

The default config lives at configs/default.json and supports the following fields:

  • numDecks: The number of decks the dealer is using
  • shuffleRatio: The ratio of the original deck size, after which the shuffler will perform a reshuffle of the deck of cards
  • players: The set of players to include in the game (the stats of each player will be displayed at the end)
  • numGames: The number of rounds to play
  • doubleDownEnabled: Whether the double down player action is enabled
  • splitEnabled: Whether the split player action is enabled
  • ddasEnabled: Whether the double down after split player action is enabled

Sample output after simulation ends:

Player: Alice, winnings: $-99650.0, total wins: 43123, total losses: 47749, total draws: 9128, win ratio: 0.43
Player: John, winnings: $-545500.0, total wins: 41047, total losses: 48566, total draws: 10387, win ratio: 0.41
Player: Timothy, winnings: $-78300.0, total wins: 43119, total losses: 47484, total draws: 9397, win ratio: 0.43

The chart strategy used is according to this table: BJA_Basic_Chart_Strategy

Project Layout

src/
  cli.py
  domain/
  probability/
  reporting/
  util/
  simulation/
  strategies/
tests/
configs/
assets/

Running

python main.py
python main.py --config configs/default.json
python main.py --test
python -m pytest tests -v

Manual test mode is terminal-driven and does not require the keyboard package or root privileges. Press Enter to play the next round and q to quit.

About

A simple python application designed to help determine the win/loss rate of a hypothetical player. Different game setups and individual player strategies can be configured to determine how they influence the outcome of the game.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors