Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Monty-Hall-problem/HicEst/monty-hall-problem-1.hicest
Normal file
32
Task/Monty-Hall-problem/HicEst/monty-hall-problem-1.hicest
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
REAL :: ndoors=3, doors(ndoors), plays=1E4
|
||||
|
||||
DLG(NameEdit = plays, DNum=1, Button='Go')
|
||||
|
||||
switchWins = 0
|
||||
stayWins = 0
|
||||
|
||||
DO play = 1, plays
|
||||
doors = 0 ! clear the doors
|
||||
winner = 1 + INT(RAN(ndoors)) ! door that has the prize
|
||||
doors(winner) = 1
|
||||
guess = 1 + INT(RAN(doors)) ! player chooses his door
|
||||
|
||||
IF( guess == winner ) THEN ! Monty decides which door to open:
|
||||
show = 1 + INT(RAN(2)) ! select 1st or 2nd goat-door
|
||||
checked = 0
|
||||
DO check = 1, ndoors
|
||||
checked = checked + (doors(check) == 0)
|
||||
IF(checked == show) open = check
|
||||
ENDDO
|
||||
ELSE
|
||||
open = (1+2+3) - winner - guess
|
||||
ENDIF
|
||||
new_guess_if_switch = (1+2+3) - guess - open
|
||||
|
||||
stayWins = stayWins + doors(guess) ! count if guess was correct
|
||||
switchWins = switchWins + doors(new_guess_if_switch)
|
||||
ENDDO
|
||||
|
||||
WRITE(ClipBoard, Name) plays, switchWins, stayWins
|
||||
|
||||
END
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
! plays=1E3; switchWins=695; stayWins=305;
|
||||
! plays=1E4; switchWins=6673; stayWins=3327;
|
||||
! plays=1E5; switchWins=66811; stayWins=33189;
|
||||
! plays=1E6; switchWins=667167; stayWins=332833;
|
||||
Loading…
Add table
Add a link
Reference in a new issue