Monty Hall problem: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring, marked p2js compatible) |
(Emacs Lisp: Improve formatting) |
||
Line 1,669:
=={{header|Emacs Lisp}}==
{{trans|Picolisp}}
<lang lisp>(defun montyhall (keep)
(choice (random 3)))▼
▲ ((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))))
(
(let ((cnt 0))
(dotimes (i 10000)
(and (montyhall nil) (setq cnt (1+ cnt))))
(
{{out}}
Strategy keep: 34.410
Strategy switch: 66.430
=={{header|Erlang}}==
|