18 Dec 01 
 
 
There are books all over the place talking about how to "beat the casino" at particular 
games like poker, blackjack, or craps.  The most intelligent (and least 
suspicious) of these talk about the optimal strategy -- the strategy that will give 
you the best results in the long run.  These books will often note that the best 
strategy will still make you =lose= money, but more slowly than you would if you 
hadn't used the best strategy.  I visited a few gambler's sites recently, 
specifically to check out video poker, and for most games, with optimal strategy, 
they promised a return of 99+%.  In one case, it was a return over 100%! 
 
I was suspicious of that, seeing as there's =scads= of ads and links to online 
casinos at that site.  I will have to check my own calculations, but I won't do all 
of them here. 
 
So, how to check out what kind of money you expect to make, or lose, in the long 
run?  One calculates the =expected value= of your profits/losses, which tells you 
what you expect to make/lose per game if you play it many, many times.   
 
So here's a payoff scheme for a particular video poker game: 
Royal Flush		250 
Straight Flush		50	 
Four of a kind		25 
Full House		9 
Flush			6 
Straight		4 
Three of a Kind		3 
Two Pairs		2 
Pair of Jacks or better	1 
 
And you pay 1 coin to play, so basically you're even if you get a pair of jacks, 
queens, kings, or aces. 
 
Now, we've calculated the probabilities for most of these occurances, except for 
Royal Flush (10, J, Q, K, A all in one suit -- only 4 ways to do this) (and this 
affects the counting for straight flush) and one pair, Jacks or better. 
 
So, there are 4 ways to make a Royal Flush, out of a total of 2598960 -  
probability: .00000154 
 
The straight flush probability now changes - from 40 ways to 36  ways - 
probability: .0000139 
 
And to get a pair of jacks or better, one must pick a face value from (J, Q, K, A), 
then pick two of the 4 cards with that face value, then pick three other face 
values, and 1 of the 4 from each of those. 
number of ways = 4_C_1*4_C_2*12_C_3*4*4*4 = 4*6*220*4*4*4 = 337920 
probability: 0.130 
 
 
So to figure out expected value, one takes a weighted average of the values - the 
weights being the probability with which one expects to get that value. 
 
 
hand			payoff	prob		product 
Royal Flush		250	.00000154	.000385 
Straight Flush		50	.0000139	.000695 
Four of a kind		25	.00024		.006 
Full House		9	.00144		.01296 
Flush			6	.001965		.011790 
Straight		4	.003925		.0157 
Three of a Kind		3	.0211		.0633 
Two Pairs		2	.0475		.0950 
Pair of Jacks or better	1	.130		.130 
 
total:						.335830 
 
 
Only 34% return!  And the site claims 99.5%!   
 
Okay, calm down, we're not done yet.  No one would play video poker with odds as 
bad as these -- any fool would notice how quickly their pile was going down and how 
rarely they won anything.  One way to fix the above problem would be to give bigger 
payouts for the rarer hands (or even a bigger payout for the most likely hand in 
the list).  When playing to a payout scheme like this, the probability of each 
outcome =and= the payouts must be taken into account. 
 
Suppose the payoffs were ten times what is given here.  Surefire 
money-maker!  Heck, even if only the payoff for royal and straight flushes were 
increased enough, you'd have a very positive value on your hands. 
 
Well, the casinos are not about to be playing losing games, they want to make money 
after all.  So why not add a little choice to the mix?  So video poker is almost 
always a 5-card draw poker game.  In this game, you are dealt a hand, and you can 
turn in any number of cards to get different cards to replace, in order to try to 
better your hand.  =However=, though certain strategies in a regular 5-card draw 
game against other people simply look for the strategy which will maximize the 
probability of getting a better hand, in video poker you have to maximize your 
expected payout.   
 
This is an optimization problem, but since it's discrete, it's a 
relatively easy optimization problem.  For any 5-card hand, you have 2^5 = 32 
possible strategies (for each card in your hand, you can either keep it, or discard 
it).  So, given a particular hand, there's only a maximum of 32 possibilities to 
try out.  Let's do that for a particular hand: 
 
 
Jack of hearts 
Queen of hearts  
Queen of spades 
King of diamonds 
Ace of hearts 
 
Now, we are sitting here with a pair of Queens, sure to get us our 1 coin back if 
we don't do anything.  However, it might be to our interest to discard some of 
those cards to see if we get a better hand.  For example, if we discard the J, K, 
and A, we could possibly get one or two more queens.  We could also could get one 
queen, and an extra pair for full house.   
 
However, we've almost got a straight.  Perhaps we should discard one queen and try 
for the straight.  As well, we've got three hearts - perhaps we should throw out 
the spade and the diamond and go for the hearts-flush.   
 
You may think you know the proper strategy in 5-card draw, and perhaps it extends 
to video poker, but optimal strategy in a payoff game like this is very dependent 
on payout schemes.  
 
I have no desire of calculating the expected payout on all 32 possible discards, 
because some of them are obviously not going to achieve a maximum expected value 
(like discarding all 5 cards, or just discarding the queens).  Let's try a few 
possibilities: 
 
 
Keep the queens, discard the 3 others: 
 
You're taking 3 cards out of the remaining 52 - 5 = 47 cards, so there's  
47_C_3 = 16215 possible outcomes. 
 
-can get four-of-a-kind by getting the other two queens, and 1 other card from the 
remaining 45 -- 45 ways - prob = .002775 
 
-can get full house by getting one other queen, and an extra pair, or by getting 
three-of-a-kind of some other value. This is a little tricky, because the 
particular Jack, King, and Ace aren't available.  So let's break it up: 
Q + non-J/K/A pair = 2_C_1*9_C_1*4_C_2 = 2*9*6 = 108 
Q + J/K/A pair = 2_C_1*3_C_1*3_C_2 = 2*3*3 = 18 
non-J/K/A triple = 9_C_1*4_C_3 = 9*4 = 36 
J/K/A triple = 3_C_1*3_C_3 = 3 
 
so a grand total of 165 ways -- prob = .0102 
 
  
-can get a three-of-a-kind by getting another queen, and two cards that aren't a 
pair.  Easily enough, rather than go through the whole J/K/A razzmatazz, let's just 
note that it's the number of ways of getting a queen, two other card, minus the 
number of ways of getting a full house: 
2_C_1 * 45_C_2 - 165 = 2*990 - 165 = 1815 ways - prob = .112 
 
-can get two pair by getting another pair of cards, and one extra card: 
non-J/K/A pair: 9_C_1*4_C_2*41_C_1 = 9*6*41 = 2214 
J/K/A pair: 3_C_1*3_C_2*42_C_1 = 3*3*42 = 378 
for a total of 2592 ways, prob = 0.160 
 
-then you can get nothing extra - just have the one pair of queens you started 
with: 
# ways = 16215 - 2592 - 1815 - 165 - 45 = 11598  
prob = .715 
 
so our expected value is:  
4-of-a-kind	25	.00278		.0695 
full house	9	.0102		.0918		 
3-of-a-kind	3	.112		.336 
2 pair		2	.160		.32 
1 pair		1	.715		.715 
 
total:				       1.532 
 
Yeah!  Much improved over our original 1, and note we are guaranteed to get at 
least 1 in return. 
 
 
 
Let's try a different strategy now.  Suppose I try to go for the royal flush:  
I'll throw out the queen of spades and king of diamonds, seeing what I can get. 
 
Again, there are 47 cards left to pick from, and we're getting 2.  So that's  
47_C_2 = 1081 possible outcomes. 
 
- can get a royal flush by getting the 10 of hearts and the King of Hearts -- 
there's only one way to do this. prob = .000925 
 
- can get a flush by getting two hearts, but not the 10 and king:  
10_C_2 - 1 = 45 - 1 =44 ways.  prob = .0416 
 
- can get a straight by getting a 10 and a king, but not both the 10 and king 
of hearts: 3_C_2*3_C_2 - 1 = 3*3 - 1 = 8. prob = .0074 
 
- can get a three-of-a-kind by getting a pair of aces, jacks, or queens: 
3_C_2 + 3_C_2 + 2_C_2 = 3 + 3 + 1 = 7.  prob = .0065 
 
- can get two pair, by getting two of one ace, one jack, or one queen: 
3_C_1*3_C_1 + 3_C_1*2_C_1 + 3_C_1*2_C_1 = 3*3 + 3*2 + 3*2 = 21 ways. prob = .0194 
 
- can get one high pair, by getting: pair of kings or one ace, jack or queen and 
something else: 
3_C_2 + 8_C_1*39_C_1 = 3	 + 8*39 = 315 ways.  prob = .291 
 
- can get absolutely nothing: 1081 - 315 - 21 - 7 - 8 -44 - 1 = 685 ways.  prob =.634 
 
let's do our chart: 
		payout	prob	  	product 
royal flush 	250	.000925	 	.23125	 
flush		6	.0416		.2496 
straight	4	.0074		.0296 
three-of-a-kind	3	.0065		.0195 
two pair	2	.0194		.0388 
one pair	1	.291		.291 
nothing		0	.634		.000 
 
total:					.85975 
 
Obviously, this strategy is less than optimal - it doesn't even achieve the 
payoff of 1 you're sure to get if you just held on to all your cards. 
 
However, if the payoff scale were different - say a royal flush were worth 500 and 
a flush were worth 18, then the total would be 1.59 -- higher than our previous 
optimal strategy. 
 
So, keep this in mind should you ever play video poker - optimal strategy is 
contingent on the payouts provided.  As long as you're not actually tampering with 
machines, most people will leave you alone as you play video poker, but sitting 
down and calculating the optimal strategy for each of the possible 2.6 million 
original hands can get to be a bit too slow as one sits there.  Luckily, there are 
standard payoff schedules and one can go to gambler's sites to take a look at them 
and sometimes even optimal strategy.  As well, one need not look at =every= 
individual possible hand, as they naturally group themselves into such things as "4 
card flush" and the like.  In any case, you could see how easy it would be to 
program a computer to determine the optimal strategy for any payoff scheme; 2.6 
million isn't really that much for a montecarlo program.   
 
If you wonder where expected value might come in handy in other places other than 
gambling, consider that ever-legal and ever-distinguished form of 
gambling: investing in stocks and bonds.  Investment corporations have complicated 
models meant to calculate the probabilities of various outcomes so that they can 
make optimal choices which will provide optimal expected payoff.  
 
Of course, the market isn't exactly controlled by pure probability.  But that's 
beyond my realm of expertise. 
 
 
Prev Year Next