Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Sleeping-Beauty-problem/11l/sleeping-beauty-problem.11l
Normal file
27
Task/Sleeping-Beauty-problem/11l/sleeping-beauty-problem.11l
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
F sleeping_beauty_experiment(repetitions)
|
||||
‘
|
||||
Run the Sleeping Beauty Problem experiment `repetitions` times, checking to see
|
||||
how often we had heads on waking Sleeping Beauty.
|
||||
’
|
||||
V gotheadsonwaking = 0
|
||||
V wakenings = 0
|
||||
L 0 .< repetitions
|
||||
V coin_result = random:choice([‘heads’, ‘tails’])
|
||||
|
||||
// On Monday, we check if we got heads.
|
||||
wakenings++
|
||||
I coin_result == ‘heads’
|
||||
gotheadsonwaking++
|
||||
|
||||
// If tails, we do this again, but of course we will not add as if it was heads..
|
||||
I coin_result == ‘tails’
|
||||
wakenings++
|
||||
I coin_result == ‘heads’
|
||||
gotheadsonwaking++ // never done
|
||||
|
||||
print(‘Wakenings over ’repetitions‘ experiments: ’wakenings)
|
||||
|
||||
R Float(gotheadsonwaking) / wakenings
|
||||
|
||||
V CREDENCE = sleeping_beauty_experiment(1'000'000)
|
||||
print(‘Results of experiment: Sleeping Beauty should estimate a credence of: ’CREDENCE)
|
||||
Loading…
Add table
Add a link
Reference in a new issue