MangoJ said:

My CA works the other way around, it calculates the probability of the dealer standing on 17-21 (and busting), for a given upcard and remaining deck composition. This is my "endgame library", for SD play it is 10 x 1GB of data, and consumed about a week for computation on my netbook.

Repeatedly calculating the dealer probabilities is by far the most time-consuming part of the whole process. I once profiled Eric's library; I think I found it was spending something like 98% of its time in the function BJDealer::computeProbabilities().

So your week of computation might be time well spent, if it has produced results once that can be reused again and again. (Presuming looking them up in such a large data file doesn't take longer than generating them on demand.)

MangoJ said:

For player strategy, I just traverse a combinatorial tree for every possible hand until I bust, and on each node I multiply my hand's total with the correct entry from the "endgame library" - selected on the remaining deck composition (and upcard). This is the stand-EV. The hit-EV is then just the hand-EV of the 10 child-hands with their probability of drawing. The hand-EV itself is then (for best strategy) the maximum of stand-EV and hit-EV.

Presumably you work backwards from 21 here, as I described, so that your child hands' EVs are known. (They could be stand EVs or hit EVs.)

MangoJ said:

If you have stand-EV and hit-EV, a double-EV is simple: it is just the stand-EV of all child-hands (twice).This would be the same as a logic of a "simple" chess computer, i.e. work from both ends of the game. Unlike chess however the middle part can be resolved exactly (as there are no cyclic Blackjack hands, and only a "few" possible anyway).

Personally I'm happy with my CA, as I can easily modify for other rules (i.e. Charlie), although it only works on single deck. Although it is far from the best algorithm (a better way would be to generate all valid player hand + dealer hand combinations, and apply a simple payout table for stand-EV). It served my curiosity well enough as a hobby programmer.

You (and assume_R) have my admiration. I found it difficult enough to gain enough understanding of Eric's code to be able to make my own modifications to it. The thought of starting from scratch on such a project fills me with dread! :grin:

MangoJ said:

Colin, I always assumed that a total-dependent strategy is just the strategy for an infinite deck - which is pretty easy to implement as drawing probabilities are always fixed (1/13 or 4/13). Can be written in a spreadsheet in just an hour.

I don't think so. (At least not in theory. As a practical matter that might be OK; I don't know.)

I suspect there are various ways to tackle the problem, but I don't know of one that is guaranteed to be optimal, at least not without making some assumptions.

We know that the total-dependent strategy for 16vs10 is to hit, while the actual compositions that can form the total of 16 vary, some are hit and some are stand.

So how do we arrive at the decision to hit every hand of 16vs10? One would think it must derive from the frequency with which the various compositions will arise. If hit-worthy 16s are more common that stand-worthy ones, then the overall decision should be to hit all 16s.

[Or more precisely, we need to sum the hit EVs of all the hand compositions totalling 16 which we may reach, weighted by the probability of reaching those hands, do the same for the stand EVs, and adopt whichever is higher as our overall action for 16vs10.]

But how do we know the frequencies of all the different compositions? They themselves ought to be a product of the strategy for the lower totals. The more totals below 16 we hit, the more multicard 16s we will generate.

We can't decide what to do with the lower totals until we have worked out the EVs of all the higher totals which we might reach by hitting them, and we can't calculate the EVs of the higher totals until we know what strategy we will be employing with the lower totals. A chicken-and-egg conundrum.:grin:

I gather the practical solution is to start out with the perfect-play EVs and hand frequencies, and use those as the basis for generating the total-dependent strategy, but I don't know how we can say with certainty that such an approach is giving us all the right answers.