Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

PerlMonks Santa (or s/Santa/friend of yours/g on PM, depending on your religious views) has given you a challenge:

You have three (3) nicely wrapped up parcels in front of you. They look, smell, weigh etc. exactly the same. Except two hold a blank scrap of paper, one of them holds a coupon for 1000XP and instant sainthood on PerlMonks (thats the one you desired for years!).

But given that you can only select ONE of the parcels at random, your changes of gratification are slim.

You select one. Then Santa removes one of the other ones. He also promises you that the one he removed was in fact one of the empty ones. You have now the chance to either stick to the one you selected or switch to the remaining one still on the table (giving the one you currently hold back to Santa).

How are your chances if you stick to the parcel you selected at the start? How are your chances if you switch to the one Santa has left on the table?

Take an educated guess and write it down.

Now, write two scripts, one where you stick to your initial decision, one where you switch. Loop a sufficient number of times (say 10000) to get some statistical significance. Did your guesses match your expectation? So, if you encounter this challenge in real life, what would be the best strategy?

Ok, here's the scripts, statistical results and the answer i came up with:

I hope this little holiday themed puzzle was enjoyable.

Happy Holidays!

BREW /very/strong/coffee HTTP/1.1
Host: goodmorning.example.com

418 I'm a teapot

In reply to Holiday parcel puzzle by cavac

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2024-03-29 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found