Monty Hall problem: Difference between revisions
Content added Content deleted
Line 943: | Line 943: | ||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |
||
<lang PureBasic> |
<lang PureBasic> |
||
Procedure MontyHall(Redecide) |
|||
Static Dim Doors(2) |
|||
Doors( |
Dim Doors(2) |
||
Doors(1) = 0 |
|||
Doors(2) = 0 |
|||
Doors(Random(2)) = 1 |
Doors(Random(2)) = 1 |
||
Pick = 2 |
Pick = 2 |
||
Line 962: | Line 960: | ||
OpenConsole() |
OpenConsole() |
||
#Tries = |
#Tries = 1000000 |
||
For I = 0 To #Tries |
For I = 0 To #Tries |
||
Win1 + MontyHall(1) |
Win1 + MontyHall(1) |
||
Line 977: | Line 975: | ||
Input()</lang> |
Input()</lang> |
||
Output:<pre> |
Output:<pre>Trial runs for each option: 1000000 |
||
⚫ | |||
Trial runs for each option: 10000000 |
|||
Wins when |
Wins when sticking: 331930 (33.19% chance)</pre> |
||
⚫ | |||
=={{header|Python}}== |
=={{header|Python}}== |