Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Monty-Hall-problem/Emacs-Lisp/monty-hall-problem.l
Normal file
15
Task/Monty-Hall-problem/Emacs-Lisp/monty-hall-problem.l
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(defun montyhall (keep)
|
||||
(let ((prize (random 3))
|
||||
(choice (random 3)))
|
||||
(if keep (= prize choice)
|
||||
(/= prize choice))))
|
||||
|
||||
(let ((cnt 0))
|
||||
(dotimes (i 10000)
|
||||
(and (montyhall t) (setq cnt (1+ cnt))))
|
||||
(message "Strategy keep: %.3f%%" (/ cnt 100.0)))
|
||||
|
||||
(let ((cnt 0))
|
||||
(dotimes (i 10000)
|
||||
(and (montyhall nil) (setq cnt (1+ cnt))))
|
||||
(message "Strategy switch: %.3f%%" (/ cnt 100.0)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue