Skip to content

BlackJack Simulator - ACEFive - Custom Scripting - Counting - Database Engine

License

Notifications You must be signed in to change notification settings

djl314/BlackJack-ACEFive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlackJack-ACEFive | Card Counting | Betting Strategies | Custom Scripting

The Simulator takes a given basic strategy(BS) as input (defined in a .csv-file) and simulates the win/loss against a random shoe with user entered number of decks. Custom Scripting, Card Counting, Progressive Betting, ACEFive, Real-Life "Walk Away" scenarios.

Using the Custom Scripting Tracker you can measure any data metric - Example - What happens to the House Edge when player exceeds standard deviation of maximum expected loss over a fixed number of hands/shoes

Capable of Tracking Card counts in ALL possible card counting strategies | Winn and Loss Streaks | House Edge vs Actual Edge | Load from file the same set of hands using different betting strategies and measure the differences Simulates REAL LIFE playing environment - user can define a "WALK_AWAY" logic to end the simulation

Counting Rules and Probabilities Courtesy of wizardofodds.com For explanation of counting card values see wizardofodds.com

Written using python 3

User can Enable or Disable card counting in GAME_OPTIONS

Definition of Terms

Class definitions:

  • Hand is a single hand of Blackjack, consisting of two or more cards - it might include a split
  • Round is single round of Blackjack, which simulates your hand(s) against the dealer's hand
  • Shoe is multiple decks of cards equal to SHOE_SIZE ** 52 card decks (typically BJ is played with 2, 6 or 8 decks)
  • Game is all hands played in a total number of SHOES
  • Master stores data and metrics across all Game(s)
  • Tracker allows custom scripting to measure data points set by user

Example of User Set Variables / Global Configuration

Variable Description
DEBUG_PRINT Prints to console details of every hand
CSV_SUMMARY Exports summary of results to CSV
CSV_DETAILS Export hand DETAILS to CSV use exported file in PLAY_FROM_FILE option
DETAIL_SUMMARY Prints to console additional details about each simulation
DB_ENABLE Insert results to SQLlite3 DB
SIMULATIONS = 5 #Simulation ends when # Shoes is reached OR Player_Bank <=BANK_RUIN OR def GetBL_WA() WALKAWAY returns True
SHOES = 12 #No. of shoes(games) to simulate in each simulation
SHOE_SIZE = 5 # No. of Decks per shoe
SHOE_PENETRATION = 0.25 # Remaining % of cards before shuffle
NO_HANDS = 2 # No of hands(players) played each round
BET_MINIMUM = 100 # Minimum Bet / hand -- MIN Bet over all hands should be 1-2 % of bank to avoid Ruin --
BET_INCREMENT = 50 # Progressive Bets - Increment wager after each win
USE212 = False # Modified Progressive
BET_MAX = BET_MINIMUM * 15 #1500 #Max amount to bet on any one hand (pre split/double)
RESET_BETS = True # Reset Bets to BET_MIN and Streaks after each shoe
EXPECTED_LOSS_RATE = 1 # In percent / divided by 100 at execution
BANK_START = 10000 # Player Bank
BANK_RUIN = 0 #0 # bank amount below for RUIN
WA_ON_STREAK = 6 # 0 to disable
WALK_AWAY = 4000 #BET_MINIMUM * NO_HANDS * 10 # PL before Ending Game = WA walkaway
WALK_AWAY_TRIGGER = 12000 #used in conjunction with TRAILING_STOP
TRAILING_STOP = 0 # % of PL to use as trailing stop once WALK_AWAY_TRIGGER is reached when PL is positve
LOSS_STOP = 0 #trailing amount from PlrBnk MIN to earn in event of WA Cut Losses
LOSS_TRIGGER = 2500 # Loss trigger point overrides LOSS_STOP to WA if PL is back to >= 0 after falling below LossTrigger
WALK_AWAY_BREAK = False # True # SET TO TRUE TO BREAK SIMULATION ON WALK AWAY - if False, simulation runs ALL shoes regardless of player PL or WalkAway logic(but tracks PL independently)
WIN_STREAK = [5,5,5] # [neg count,neutral count, pos count]- dflt WIN_STREAK[1]
MAX_WIN_STREAK = 7 # MAXIMUM # of wins streak before lowering bet / #setting bet to minimum / overrides other streak settings
WIN_STREAK_RESET = False # Reset progressive after streak is reached - eg. if true hand is no. 7 bet as if 2nd win, etc

HOUSE_RULES

SIM can enable/disable the following HOUSE_RULES:

  • triple7 | 3 7's counted as a blackjack *
  • hitsoft17 | house hits soft 17's *
  • allowsurr | house allows Late Surrender *
  • 65BJ | Pay 6-5 odds on Black Jack

These House Rules are Hard Coded:

  • Double down after splitting hands on any 2 cards permitted
  • No BlackJack after splitting hands
  • Split aces only once

Strategy

6Deck_Strategies.xlsx included Strategy is passed into the simulator as a .csv file.

  • The first column shows both player's cards added up
  • The first row shows the dealers up-card
  • S ... Stand
  • H ... Hit
  • Sr ... Surrender otherwise Hit
  • RS ... Surrender; otherwise Stand
  • D ... Double Down
  • P ... Split

Sample Output (short summary)

####### SIMULATION no. 1 ########
PnL: $ 975.00 -- FINAL Bank: 10975.00
Max Bank: $11325 at 109 | Min Bank: $8875 at 73
Range: $2450 | Max Loss: $1125
Avg bet/hnd: 155.88 Total bets: 18550.00

House Edge: -5.882
Actual Edge: 8.193
Win Rate: 12.771
win/bet = 5.256 %)
Theo PnL: $ 1091.16
Casino Exp Loss: $ -185.50

######## SIMULATION no. 2 ########
PnL: $ -775.00 -- FINAL Bank: 9225.00
Max Bank: $11100 at 63 | Min Bank: $8125 at 37
Range: $2975 | Max Loss: $1875
Avg bet/hnd: 149.19 Total bets: 18350.00

House Edge: 8.943
Actual Edge: -6.301
Win Rate: -9.400
win/bet = -4.223 %)
Theo PnL: $ -1641.09
Casino Exp Loss: $ -183.50

<<<SUMMARY OF 2 SIMULATIONS>>>
Total Hands : 242
WalkAways: 0.0 Reason:WinStreak 0, Profit 0, TrailStop 0, Cutloss 0, RUIN 0
TotPL: $ 200.00 WA_PnL: $ 200.00

About

BlackJack Simulator - ACEFive - Custom Scripting - Counting - Database Engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages