crapstable_a6

Document Actions
  • Bookmarks

— Objective-C source code, 1 kB (1538 bytes)

File contents

% crapstable_a6, a script m.file
% This calculates the odds of craps if the game is played with 
% loaded dice a6 flats.
% 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_a6.m, Mosteller's elegant solution to craps odds
Pexact=zeros(1,11);
Pnumber=zeros(1,11);
Pa6exact=zeros(1,11);
Pa6number=zeros(1,11);
for i=1:11;
    % calculates exact p and probability of each number on 1st toss
    [Pexact(i),Pa6exact(i),Pnumber(i),Pa6number(i)]=crapsmof65_ace6(i+1);
end
disp('Column 1: Number rolled on 1st toss');
disp('Column 2: Fair dice P of rolling the number in the 1st column');
disp('Column 3: P(winning with fair dice) if number in the 1st column rolled on 1st toss');
disp('Column 4: Loaded dice P of rolling the number in the 1st column');
disp('Column 5: P(winning with loaded dice) if number in the 1st column rolled on 1st toss');
disp(' ');
disp([2:12; Pnumber; Pexact ;Pa6number ;Pa6exact]')
fprintf('Probability of winning at craps with fair dice\n')
fprintf('is the sum of the products of the 2nd & 3rd columns:\n')
fprintf('Pwinning=sum(Pnumber.*Pexact) = %6.4f\n',...
    sum(Pnumber.*Pexact));
fprintf('Probability of winning at craps with loaded dice (ace-6 flats)\n')
fprintf('is the sum of the products of the 4th & 5th columns:\n')
fprintf('Pwinning=sum(Pnumber.*Pexact) = %6.4f\n',...
    sum(Pa6number.*Pa6exact));