% crapstable, a script m.file
% Calculates a table of craps expected values for winning.
% Written by E. Gallagher 6/2/03 for ECOS601
% Eugene.Gallagher@umb.edu
% calls craps.m, which calls absorb.m
Pexact=zeros(1,11);
Pnumber=zeros(1,11);
for i=1:11;
    [Pexact(i),Pnumber(i)]=craps(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('Column 4: Column 2 * Column 3')
disp([2:12; Pnumber; Pexact;Pnumber.*Pexact]')
disp('Probability of winning at craps is sum 2nd column times the third')
disp('(= sum of 4th column). Pwinning=sum(Pnumber.*Pexact)')

Pwinning=sum(Pnumber.*Pexact)