Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

In my opinion, this great thread still needs a simple Perl script to prove what's going on. Here it is, so that you can play the game yourself against the script. In order to avoid any confusion about the source of the numbers in the envelope you have to specify them as parameters to the script yourself. The third required parameter is the number of repetitions in the simulation to evaluate the odds.

use strict; use warnings; use List::Util qw(min max); sub chose { my $x=shift; $x>0?1-chose(-$x):0.5*exp($x) } my ($a,$b,$n) = @ARGV; # provide numbers and repetitions on command li +ne my $ctr = $n; my $correct = 0; while($ctr--){ my $envelope = rand()<0.5?$a:$b; # pick an envelope at random my $answer = rand()<1-chose($envelope)?'low':'high'; $correct++ # count the correct answers if ( $envelope==min($a,$b) and $answer eq 'low' ) or ( $envelope== +max($a,$b) and $answer eq 'high' ); } printf"Correct ones: %20.17f%%, theoretical odds: %20.17f%%\n", 100*$c +orrect/$n, 50+50*(chose(max($a,$b))-chose(min($a,$b)));

IMHO, the script is simple enough to prove that no cheating is going on.

If you play with the inputs you can see that if you provide numbers that are easily distinguishable (by the chose function) the odds are significantly larger than 50% (for example choosing -1 and 1 will lead to odds larger than 80%). If numbers are less distinguishable like 100 and 200, the odds will converge to 50%, and the simulation error will be larger than the advantage.

Great puzzle!

In reply to Re: Spooky math problem by hdb
in thread Spooky math problem by tilly

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (4)
    As of 2019-10-15 02:26 GMT
    Find Nodes?
      Voting Booth?