1

The basic strategy of blackjack has been built using computer simulations. Let's say I program the simulation's "player" to play with a certain strategy, hitting, standing or whatever given certain player and dealer hands. I then run the simulation, having the "player" play possibly millions of hands and then I observe the results.

But how are the results interpreted? I could count how many hands the player won and lost. If the player lost a lot of money, then definitely there was something wrong with my strategy, and I would need to adjust it. But how would I know what to change? There is a large number of possibilities, and I don't know which part of my strategy influenced my big losses and how much. Is there some kind of algorithm for this? I suppose I could just randomize the strategy until I find a one that brings the player most money, but that doesn't seem to be very effective.

Also, how does betting work in these simulation? Is there usually a fixed bet or is there some kind of betting strategy being implemented also?

I haven't been able to find much code or anything that would explain how these simulations work in more detail.

  • I would start by studying the already existing and well known strategies - all of which are well founded in both probability and game theory. While it is undoubtedly possible to achieve marginal improvements on these, the likelihood of a wholly new strategy being an improvement is zero. – Forget I was ever here Jan 5 at 12:26
  • @Forget I was ever here I think you've misinterpreted my question. I'm not looking to improve any existing strategies (which I am familiar with quite well), I'm interested in how these strategies were developed in the first place. Modern blackjack strategy tables are more based on simulation than calculation. – S. Rotos Jan 5 at 13:07
  • Your answer is going to be highly dependent on what the simulation is trying to determine. Is it just trying to figure out the basic win rate based on when you take actions? Is it trying to determine what the best bets to place are? – Joe W Jan 5 at 19:51
  • There's probably a tractable exact solution. Having counted all the previously seen cards, you can get exact probabilities for each value drawn, and thus can calculate the expectation for winning or losing for each possible move. – Caleth Jan 8 at 11:24
1

Any simulation is based upon a set of assumptions - the simplest assumption in blackjack is that any card drawn will be of value 10 (i.e., 10, J, Q, K). You run your simulation with that assumption, which drives your strategy (e.g., the simplest being hit if you have 11 or less, stand if you don't). Run a million hands and see how you fared.

If you're not in the hole by a lot, great. Your strategy works reasonably well, and you could stop there if you wanted. If you are down a lot of money, then you need to start modifying your strategy until you find one that works well (enough). And, without some guiding principles based on probability and such, to do that you really do need to test just about every possible strategy you can think of (within reason).

The beauty of this is that computers are really good at running millions and billions of hands, and so running all these simulations is not as bad as it may sound (I would expect a well-written program to be able to simulate 1 million hands in a matter of minutes, so you can run hundreds or thousands of different iterations in a day). If you can apply some math and statistics, you can likely reduce the number of modifications you need to run.

So you start out by modifying your bet (double down if you have 11, for instance), or your hit/stand rules (split Aces), or your assumptions (hit on 12 if the dealer shows 10, because even though you're likely to draw a 10 there's a possibility you won't). The key is to only modify one element at a time. At the end of each run, compare your final chip count. Find the run with the highest and there you go. You could then start to combine some of your highest scoring modifications and see how the combination fairs (double down if you have 10 or 11, for example).

In the end you wind up with a set of rules for how the player should bet and play, to maximize their winnings / minimize their losses.

This is a type of simulation called Monte Carlo simulation, in that it uses a random hand to simulate the play. Run enough times, the randomness can lead to a deterministic answer. In fact, each time you run your simulation, you are trying to calculate the house advantage - if you start with $100 and wind up with $98, the house has a 2% advantage (or something like that). The closer you get to simulating perfect play, the closer you get to calculating the true house advantage.

1

The optimal player strategy of BJ is well studied and known. A quick google search will present you tons of charts similar to this one.

The way to find the optimal action in each situation is, as mmathis said, Monte Carlo simulation: in each position {hand of the player, card of the dealer} simulate about a million times what will be the player's profit if she plays each of the actions. Then choose the action with the highest average profit in each situation.

As far as I know, betting sizing does not work anymore since dealers shuffle the cards before the reaching the bottom of all the cards.

the last 60 to 75 cards or so will not be used. (Not dealing to the bottom of all the cards makes it more difficult for professional card counters to operate effectively.) BJ rules

Pseudocode:

list_of_best_actions = []    
for each hand of the player:
    for each hand of the dealer:
        maximal_average_profit = 0
        best_action = None
        for each action from possible_actions:
             profit = 0
             for iteration (1,n):
                  profit += play(action)
             average_profit = profit / n
             if average_profit > maximal_average_profit
                 best_action = action
    list_of_best_actions.append(best_action)

BJ strategy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.