function Yahtzee % Coded by NFr on 8.29.17 % This code simulates 5 dice being thrown and tracking number of yahtzees % NT = 100000; Count = 0; for i = 1:NT % One throw: Dice = ceil(rand(5,1)*6) % Let's check if we have a yahtzee throw N1 = Dice(1,1); if Dice(2,1) == N1 && Dice(3,1) == N1 && Dice(4,1) == N1 && Dice(5,1) == N1 %disp('Yahtzee!!!') Count = Count + 1; else %disp('Try again.') end end Prob = Count/NT*100 end