# On Sixes And Sevens

You will recall that the Baron's wagers involved dealing out a single suit of cards, six for Sir R----- and seven for himself. In the first Sir R----- would receive twice the face value plus one coins for each card from the Baron who would in his turn take twice the face value less one from Sir R-----. In the second the Baron would have three of Sir R-----'s coins if his total score were the greater and Sir R----- would have seven of the Baron's otherwise.

Now figuring the average payoffs for such games is complicated by the fact that each card can only be drawn once. If we consider dealing the Baron's hand first there are thirteen possible outcomes for the first card, but only twelve for the second and eleven for the third, et cetera.
The total number of possible hands that the Baron might draw is therefore given by
$13 \times 12 \times \dots \times 7 = \frac{13!}{6!}$
where the exclamation point stands for the factorial.
This is known as the number of permutations and, if we were to choose $$r$$ from $$n$$ items, is written as
$^nP_r = \frac{n!}{(n-r)!}$
In the case of the Baron's wager this equates to 8,648,640 possible outcomes and adding up the payoffs for each of them would be a daunting prospect indeed!
Fortunately a simple observation greatly simplifies the calculation for the first wager. Specifically, the universe of possibilities for the Baron's first six cards must be identical to that of Sir R-----'s entire hand; they are both six cards dealt at random after all!
If we denote the average sum of a deal of $$n$$ cards with $$S_n$$ then the Baron's expected prize is
$2 \times S_6 - 6 + 2 \times S_1 - 1$
and Sir R-----'s is
$2 \times S_6 + 6$
We should consequently expect the Baron's bounty to exceed Sir R-----'s by
$\left(2 \times S_6 - 6 + 2 \times S_1 - 1\right) - \left(2 \times S_6 + 6\right) = 2 \times S_1 - 13$
so we need only concern ourselves with the expected value of a single card chosen at random which is trivially given by
\begin{align*} S_1 &= \frac{1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + J(10) + Q(10) + K(10)}{13}\\ &= \frac{85}{13}\\ &= 6 \frac{7}{13} \end{align*}
We should therefore expect the Baron to come out ahead by
$2 \times 6 \frac{7}{13} - 13 = 13 \frac{1}{13} - 13 = \frac{1}{13}$
so my counsel for Sir R----- would have been to decline this wager.

Now for the second wager, despite its simpler manner of play, I could not figure any such tricks to simplify the calculation of the payoff. One point worth noting however, is that for both wagers the order in which the cards were counted would have had no impact upon the outcome.
We could therefore have chosen any of the seven cards to count first, then any of the six remaining to count second and so on. As a result we need only consider hands sorted in increasing order, reducing the number we need consider by a factor of $$7!$$ to $$1,716$$.
This number of ways we can choose $$r$$ from $$n$$ items if we don't care about their order is known as the number of combinations and is written as
$^nC_r = \frac{n!}{r! \times (n-r)!}$
To enumerate every possible combination without missing any out might seem rather a tall order given their number, but fortunately there is a simple, if not particularly efficient, scheme for doing so.
If we write out a number in binary rather than decimal we can associate each item with one of the digits and divide them into included and excluded groups according to whether it holds a one or a zero. Naturally, we should skip any numbers that do not have the requisite numbers of set or unset bits.
For example, if we assign unset bits to the Baron and set bits to Sir R----- we can equate
$1862 = 0011101000110$
as a hand for Sir R----- of

and one for the Baron of

Armed with this simple scheme, together with a good supply of candles and coffee, my fellow students and I resolved to work through the night evaluating every possible combination of cards in order to figure Sir R-----'s chances.

Program 1: Figuring The Second Wager

By daybreak we had determined that Sir R----- had 506 chances in 1716 possible hands of winning 7 coins and, consequently, 1210 chances of losing 3. His expected winnings were therefore
$7 \times \frac{506}{1716} - 3 \times \frac{1210}{1716} = -\frac{22}{429} = -\frac{2}{39}$
and, once again, I could not in good conscience have advised him to take the wager.
$$\Box$$