clear
clc
tic
sample_max=10000000;
my_number=7;
win=zeros(1,26);
lose=zeros(1,26);
session=1;
able=1;
for bouns=4;
for sample=1:sample_max
able=1;
while able==1
base_number=my_number;
my_number=fix((rand*6+1))+fix((rand*6+1));
if base_number<7
if base_number<my_number+bouns;
win(session)=win(session)+1;
session=session+1;
if session==26
lose(session)=lose(session)+1;
session=1;
able=0;
my_number=7;
end
else
lose(session)=lose(session)+1;
session=1;
able=0;
my_number=7;
end
end
if base_number>8
if base_number>my_number-bouns;
win(session)=win(session)+1;
session=session+1;
if session==26
lose(session)=lose(session)+1;
session=1;
able=0;
my_number=7;
end
else
lose(session)=lose(session)+1;
session=1;
able=0;
my_number=7;
end
end
end
end
win=win/sample_max*100;
lose=lose/sample_max*100;
toc
|