Monty Hall problem: Difference between revisions

Content added Content deleted
Line 2,039: Line 2,039:


{{FormulaeEntry|page=https://formulae.org/?script=examples/Monty_Hall_problem}}
{{FormulaeEntry|page=https://formulae.org/?script=examples/Monty_Hall_problem}}

'''Solution'''

The following program makes a given number of simulations. On each, three options are evaluated:

* If the player keeps his/her selection
* If the player randomly chooses between hs/her selection and the other (closed) door.
* If the player switches his/her selection

Finally, it shows the number of wins for each case.

[[File:Fōrmulæ - Monty Hall problem 01.png]]

[[File:Fōrmulæ - Monty Hall problem 02.png]]

[[File:Fōrmulæ - Monty Hall problem 03.png]]

It can be seen that:

* If the player keeps his/her selection, he/she wins around 1/3 of times
* If the player randomly chooses between his/her selection and the other (closed) door, he/she wins around 1/2 of times
* If the player switches his/her selection, he/she wins around 2/3 of times

The following variation shows the evolution of the probabilities for each case:

[[File:Fōrmulæ - Monty Hall problem 04.png]]

[[File:Fōrmulæ - Monty Hall problem 05.png]]

[[File:Fōrmulæ - Monty Hall problem 06.png]]


=={{header|Go}}==
=={{header|Go}}==