Sleeping Beauty problem: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: oops) |
(Added Quackery.) |
||
Line 483: | Line 483: | ||
Sleeping Beauty should estimate credence |
Sleeping Beauty should estimate credence |
||
at around 0.333</pre> |
at around 0.333</pre> |
||
=={{header|Quackery}}== |
|||
<lang Quackery> [ $ "bigrat.qky" loadfile ] now! |
|||
[ say "Number of trials: " |
|||
dup echo cr |
|||
0 ( heads count ) |
|||
0 ( sleeps count ) |
|||
rot times |
|||
[ 1+ |
|||
2 random if |
|||
[ 1+ dip 1+ ] ] |
|||
say "Data: heads count: " |
|||
over echo cr |
|||
say " sleeps count: " |
|||
dup echo cr |
|||
say "Credence of heads: " |
|||
2dup 20 point$ echo$ cr |
|||
say " or approximately: " |
|||
10 round vulgar$ echo$ cr ] is trials ( n --> n/d ) |
|||
1000000 trials</lang> |
|||
{{out}} |
|||
<pre>Number of trials: 1000000 |
|||
Data: heads count: 500212 |
|||
sleeps count: 1500212 |
|||
Credence of heads: 0.33342754224069664821 |
|||
or approximately: 1/3 |
|||
</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |