% crapstable2, a script m.file
% Calculates a table of expected values for winning at craps.
% Written by E. Gallagher 6/2/03 for ECOS601, now EEOS601
% Eugene.Gallagher@umb.edu
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% calls crapsmof65.m, Mosteller's elegant solution to craps odds
Pexact=zeros(1,11);
Pnumber=zeros(1,11);
for i=1:11;
    [Pexact(i),Pnumber(i)]=crapsmof65(i+1); % calculates exact p and 
                                            % probability of each number on
                                            % 1st toss
end
disp('Column 1: Number rolled on 1st toss');
disp('Column 2: Probability of rolling the number in the 1st column');
disp('Column 3: P(winning) if you roll the number in the 1st column');
disp([2:12; Pnumber; Pexact]')
disp('Probability of winning at craps is sum 2nd column times the third')
disp('Pwinning=sum(Pnumber.*Pexact)')

Pwinning=sum(Pnumber.*Pexact)