Monty Hall problem: Difference between revisions

Content added Content deleted
(→‎{{header|XPL0}}: The procedure Play replaced by a pure function.)
m (→‎{{header|XPL0}}: Output statements together.)
Line 5,180: Line 5,180:


[Format(2,1);
[Format(2,1);
Text(0, "NOT switching doors wins car in ");
NWins:= 0;
NWins:= 0;
for Game:= 0 to NGames-1 do
for Game:= 0 to NGames-1 do
if IsGameWon(false) then NWins:= NWins+1;
if IsGameWon(false) then NWins:= NWins+1;
Text(0, "NOT switching doors wins car in ");
RlOut(0, float(NWins)/float(NGames)*100.0);
RlOut(0, float(NWins)/float(NGames)*100.0);
Text(0, "% of games.^M^J");
Text(0, "% of games.^M^J");


Text(0, "But switching doors wins car in ");
NWins:= 0;
NWins:= 0;
for Game:= 0 to NGames-1 do
for Game:= 0 to NGames-1 do
if IsGameWon(true) then NWins:= NWins+1;
if IsGameWon(true) then NWins:= NWins+1;
Text(0, "But switching doors wins car in ");
RlOut(0, float(NWins)/float(NGames)*100.0);
RlOut(0, float(NWins)/float(NGames)*100.0);
Text(0, "% of games.^M^J");
Text(0, "% of games.^M^J");