Graphics Programs Reference
In-Depth Information
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.44
The numbers now hover between 36 and 47% upon multiple runnings of
this scenario; so finally, suppose he cowers in the corner.
x1=50;y1=50;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.64
We saw numbers between 56 and 64%.
Search WWH ::




Custom Search