Graphics Programs Reference
In-Depth Information
else
c=c+1;
end
end
disp(['The chances of Picard surviving are = ', ...
num2str(c/100)])
The chances of Picard surviving are = 0.16
We ran this a few times and saw survival chances ranging from 9 to 16%.
(d)
x1 = 37.5; y1 = 25;c=0;
for k = 1:100
h=0;
for n = 1:100
x0 = 50*rand;
y0 = 50*rand;
r = lifeordeath(x1, y1, x0, y0);
h=h+r;
end
ifh>0
c=c;
else
c=c+1;
end
end
disp(['The chances of Picard surviving are = ',...
num2str(c/100)])
The chances of Picard surviving are = 0.17
This time the numbers were between 10 and 18%. Let's keep moving him
toward the periphery.
(e)
x1=50;y1=25;c=0;
for k = 1:100
h=0;
Search WWH ::




Custom Search