Monty Hall problem: Difference between revisions
Content added Content deleted
Line 666: | Line 666: | ||
=={{header|J}}== |
=={{header|J}}== |
||
<lang j> |
|||
NB. Monty Hall Simulation (a tacit version) |
|||
'SIZE CAR STAY MONTY SWITCH DOORS ALL'=. i.7 NB. Setting mnemonics for boxes |
'SIZE CAR STAY MONTY SWITCH DOORS ALL'=. i.7 NB. Setting mnemonics for boxes |
||
Line 690: | Line 691: | ||
sim=. (StayDisplay ; SwitchDisplay) o switch o Monty o all o stay o car o doors o boxes f. |
sim=. (StayDisplay ; SwitchDisplay) o switch o Monty o all o stay o car o doors o boxes f. |
||
</lang> |
|||
Example: |
|||
<lang j> |
|||
sim 1000000 |
sim 1000000 |
||
+--------------+----------------+ |
+--------------+----------------+ |
||
|Stay: 0.333143|Switch: 0.666857| |
|Stay: 0.333143|Switch: 0.666857| |
||
+--------------+----------------+ |
+--------------+----------------+ |
||
</lang> |
|||
=={{header|Java}}== |
=={{header|Java}}== |