Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
|||
Module CheckIt {
|
||||
Enum Strat {Stay, Random, Switch}
|
||||
total=10000
|
||||
Print $("0.00")
|
||||
player_win_stay=0
|
||||
player_win_switch=0
|
||||
player_win_random=0
|
||||
For i=1 to total {
|
||||
Dim doors(1 to 3)=False
|
||||
doors(Random(1,3))=True
|
||||
guess=Random(1,3)
|
||||
Inventory other
|
||||
for k=1 to 3 {
|
||||
If k <> guess Then Append other, k
|
||||
}
|
||||
If doors(guess) Then {
|
||||
Mont_Hall_show=other(Random(0,1)!)
|
||||
} Else {
|
||||
If doors(other(0!)) Then {
|
||||
Mont_Hall_show=other(1!)
|
||||
} Else Mont_Hall_show=other(0!)
|
||||
Delete Other, Mont_Hall_show
|
||||
}
|
||||
Strategy=Each(Strat)
|
||||
While Strategy {
|
||||
Select Case Eval(strategy)
|
||||
Case Random
|
||||
{
|
||||
If Random(1,2)=1 Then {
|
||||
If doors(guess) Then player_win_Random++
|
||||
} else If doors(other(0!)) Then player_win_Random++
|
||||
}
|
||||
Case Switch
|
||||
If doors(other(0!)) Then player_win_switch++
|
||||
Else
|
||||
If doors(guess) Then player_win_stay++
|
||||
End Select
|
||||
}
|
||||
}
|
||||
Print "Stay: ";player_win_stay/total*100;"%"
|
||||
Print "Random: ";player_win_Random/total*100;"%"
|
||||
Print "Switch: ";player_win_switch/total*100;"%"
|
||||
}
|
||||
CheckIt
|
||||
Loading…
Add table
Add a link
Reference in a new issue