Last week I wrote a SAS/IML program that computes the odds of winning the game of craps. I noted that the program remains valid even if the dice are not fair. For convenience, here is a SAS/IML function that computes the probability of winning at craps, given the probability vector for each of the two six-sided dice. The program is explained in the previous article.

```proc iml; start CrapsWin(dieProb); probs = dieProb` * dieProb; /* joint prob = product of marginals */ events = repeat(1:6, 6) + T(1:6); P = j(1, 12, 0); /* probability of each event */ do i = 2 to ncol(P); /* P(sum=2), ..., P(sum=12) */ idx = loc( events=i ); P[i] = sum( probs[idx] ); end; point = (4:6) || (8:10); /* Pr(7 or 11) + Prob(Making Point) */ Pwin = P[7] + P[11] + sum(P[point]##2 / (P[point] + P[7])); return( Pwin ); finish;```

I got interested in this problem when I stumbled upon a Web page by Jung-Chao Wang for a course at Western Michigan University. Wang discusses the probability of winning at craps when the game is played with unfair dice. In particular, the Web page shows how the probabilities of winning at craps change if the dice are "shaved." A "shaved die" is one that is not perfectly cubical, so that the faces with less area have a smaller probability of appearing than the faces with larger areas.

For example, you can increase the probability of rolling a 1 or 6 by sanding or trimming those two faces. The area of the 1 and 6 faces do not change, but the other four faces now have less area. Of course, you could also shave the non-1 and non-6 faces, which has the opposite effect. Wang calls this "negative shaving." (By "you," I really mean "an unscrupulous cheat." This discussion is purely a theoretical exercise in probability; I do not advocate cheating.)

For each pairs of faces (such as 1-6) you can consider the odds of winning at craps when you play with two identical dice that have been negatively or positively shaved. What is interesting to me is that the effect of shaving depends (strongly) on the faces that you shave. If you shave the 1-6 face, you get a dramatically different behavior than if you shave the 2-5 or 3-4 faces.

The results are shown in the preceding graph (click to enlarge). If you shave the 1 and 6 faces, you dramatically decrease the probability of the shooter winning. If you shave the 3 and 4 faces, you increase the probability, but the effect is not as dramatic. Presumably "the house" would want to shave the 1 and 6 sides, whereas a crooked shooter would want to try to replace the house dice with dice that are shaved on the 3 and 4 faces. However, to increase the probability of the shooter winning by, say, 5%, the 3-4 faces would need to be shaved by a lot. In contrast, to decrease the probability of the shooter winning by 5%, much less tampering is required of the 1-6 faces. Thus the "house" that cheats is less likely to be detected than the shooter that cheats!

Here's the program that creates the graph:

```/* change probability of landing on 1-6, 2-5, or 3-4 sides */ /* Idea from J. C. Wang: http://www.stat.wmich.edu/wang/667/egs/craps2.html */ shaved = T( do( -1/12, 1/6, 0.01 ) ); WinProb = j(nrow(shaved), 3); /* results: winning probability */ do side = 1 to 3; do i = 1 to nrow(shaved); dieProb = j(1, 6, 1/6 - shaved[i] ); dieProb[side||7-side] = 1/6 + 2*shaved[i]; WinProb[i, side] = CrapsWin(dieProb); end; end;   /* graph the data with PROC SGPLOT */ A = shaved || WinProb; create Craps from A[c={"Shaved" "Side1" "Side2" "Side3"}]; append from A; close Craps; quit;   proc sgplot data=Craps; title "Probability of Winning at Craps with Unfair Dice"; series x=Shaved y=Side1 / curvelabel="Sides 1 & 6"; series x=Shaved y=Side2 / curvelabel="Sides 2 & 5"; series x=Shaved y=Side3 / curvelabel="Sides 3 & 4"; yaxis grid values=(0.35 to 0.7 by 0.05) label="Probability of Winning"; xaxis grid label="Change in Probability"; run;```

I really like this graph because it reveals how important various pairs of faces are to making a point.

For example, a pair of dice that rolls many 1s and 6s are bad for the shooter, because the most common sums will be 2, 7, and 12. You lose if 2 or 12 appear on the first roll, although you win with a 7. However, if you happen to establish a point, you are in trouble. Rolling a 2 or 12 doesn't help you make your point, so the most likely scenario is that you will roll a 7 and lose.

In contrast, a pair of dice that rolls many 3s and 4s is good for the shooter. The most common sums will be 6, 7, and 8. You win with a 7. If you establish a point, it is likely to be a 6 or 8, which are the easiest points to make.

The ideas discussed in this article also apply to other kinds of "crooked dice." The SAS/IML program opens up a variety of scenarios to simulate. For example, if only one face appears more than the others, which face would the shooter want it to be? Which face would the house want it to be? You could also modify the SAS/IML function to take two probability vectors, one for each die. Have fun simulating these scenarios, but remember: no cheating in real life!

Share