Monty Hall problem: Difference between revisions

m
m (moved the task's requirements at the beginning to the ;Task: section, broke apart a long paragraph for easier comprehension, consolidate the references, added ;Note: and ;query: sections, added whitespace, noted that the video is on YouTube.)
Line 1,584:
: play ( - f ) setup choose reveal applyStrategy open ;
: record ( f ) 1 and wins +! ;
: run 0 wins ! rounds 0 ?DO play record LOOP ;
: result wins @ 0 d>f rounds 0 d>f f/ 100e f* ;
run : ." Switch door => " result result f. '%' emit cr;
 
' keep IS applyStrategy run ." Keep door => " .result cr
' switch IS applyStrategy run ." KeepSwitch door => " .result f. '%' emit cr
bye</lang>
 
' switch IS applyStrategy
run ." Switch door => " result f. '%' emit cr
 
bye
</lang>
 
{{out}}
Anonymous user