% DeMere's Problem: In rolling of 3 fair dice which
% outcome is more likely: sum 11 or sum 12?

  disp('DeMere Problem')
  lw = 2; 
  set(0, 'DefaultAxesFontSize', 16);
  fs = 15;
  rand('twister',20)
  msize = 10;
% end of preabmle-------------------------------------
close all
nof11 =0;  nof12=0; %count the outcomes 11, 12  
M=100000; %number of rolls of 3 dice
for i= 1:M
  die1 = ceil(6*rand);
  die2 = ceil(6*rand);
  die3 = ceil(6*rand);
  sum3dies = die1 + die2 + die3;
  if (sum3dies == 11) nof11=nof11 + 1;
  elseif (sum3dies == 12) nof12=nof12 + 1;
  end
end
probsum11 = nof11/M  %0.1253 (theoretical 27/6^3 = 0.1250)
probsum12 = nof12/M  %0.1152  (theoretical 25/6^3 = 0.1157)