A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
19
Task/Monty-Hall-problem/PicoLisp/monty-hall-problem.l
Normal file
19
Task/Monty-Hall-problem/PicoLisp/monty-hall-problem.l
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(de montyHall (Keep)
|
||||
(let (Prize (rand 1 3) Choice (rand 1 3))
|
||||
(if Keep # Keeping the first choice?
|
||||
(= Prize Choice) # Yes: Monty's choice doesn't matter
|
||||
(<> Prize Choice) ) ) ) # Else: Win if your first choice was wrong
|
||||
|
||||
(prinl
|
||||
"Strategy KEEP -> "
|
||||
(let Cnt 0
|
||||
(do 10000 (and (montyHall T) (inc 'Cnt)))
|
||||
(format Cnt 2) )
|
||||
" %" )
|
||||
|
||||
(prinl
|
||||
"Strategy SWITCH -> "
|
||||
(let Cnt 0
|
||||
(do 10000 (and (montyHall NIL) (inc 'Cnt)))
|
||||
(format Cnt 2) )
|
||||
" %" )
|
||||
Loading…
Add table
Add a link
Reference in a new issue