Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
36
Task/Monty-Hall-problem/PostScript/monty-hall-problem.ps
Normal file
36
Task/Monty-Hall-problem/PostScript/monty-hall-problem.ps
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
%!PS
|
||||
/Courier % name the desired font
|
||||
20 selectfont % choose the size in points and establish
|
||||
% the font as the current one
|
||||
|
||||
% init random number generator
|
||||
(%Calendar%) currentdevparams /Second get srand
|
||||
|
||||
1000000 % iteration count
|
||||
0 0 % 0 wins on first selection 0 wins on switch
|
||||
2 index % get iteration count
|
||||
{
|
||||
rand 3 mod % winning door
|
||||
rand 3 mod % first choice
|
||||
eq {
|
||||
1 add
|
||||
}
|
||||
{
|
||||
exch 1 add exch
|
||||
} ifelse
|
||||
} repeat
|
||||
|
||||
% compute percentages
|
||||
2 index div 100 mul exch 2 index div 100 mul
|
||||
|
||||
|
||||
% display result
|
||||
70 600 moveto
|
||||
(Switching the door: ) show
|
||||
80 string cvs show (%) show
|
||||
70 700 moveto
|
||||
(Keeping the same: ) show
|
||||
80 string cvs show (%) show
|
||||
|
||||
|
||||
showpage % print all on the page
|
||||
Loading…
Add table
Add a link
Reference in a new issue