RE: [REBOL] Re: A Rebol Challenge.  The Monty Hall Puzzle

[EMAIL PROTECTED] wrote:
> 
> On 17-Dec-01, Carl Read wrote:
> 
> > Here's a fixed version...
> 
> > rebol[]k: s: 0 r: func[n][random n]m: does[p: r 3 c: r 3 p = c] loop
> > 10000 [if m[k: k + 1]if not m[s: s + 1]]print ["Kept" k "Switched"
> > s]
> 
> > Nowhere near as short as some of the other posts, but anyway, here's
> > my reasoning behind it...
> 
> > The prize is placed behind one of 3 doors...
> 
> >    prize: random 3
> 
> > You choose one of the doors...
> 
> >    chosen: random 3
> 
> > Now, Monty can see if they're a match - ie, if you've picked a
> > winner...
> 
> >    matched?: prize = chosen
> 
> > Which returns true if you've chosen the prize. If you decide to keep
> > this then it's obvious (I hope:) that you had 1 chance in 3 of
> > picking the prize.
> 
> > But what if you accept Monty's offer to switch?  Well, there's only
> > two posibilities:
> 
> > 1) You'd chosen the prize, so switching from that means you lose
> > regardless of what Monty does.
> 
> > 2) You hadn't chosen the prize, Monty exposes the other losing door,
> > and so you switch to the winning door.
> 
> > So a switch always means a reversal of your original choice - a
> > winning choice becoming a losing one and vice-versa.  So...
> 
> >    matched?: not matched?
> 
> > But what happens to the "1 chance in 3 of picking the prize."? Well
> > that also means you had 2 chances in 3 of losing, right? And the
> > switch makes an original loss a win, so switching gives you 2
> > chances in 3 of winning, thus doubling your chances of a win.
> 
> After showing the above explaination to someone (not on this list)
> they still didn't believe it, so I've written a graphical version in
> the hope that pictures will win out where words fail...  (Not a View
> version though - run it from the Console.)
>

well, thats to complicated to me, i give up.
i have a 2/3 choice to get a priceless door, this chances are
better, and so i want to be priceless.
hey, and if i hit, Monty will show me the other priceless door!
so i have two :)

happy without a price
-Volker ;-)
 
> 
> rebol []
> doors: func [n c][
>     d: copy/deep ["[ ]" "[ ]" "[ ]"]
>     d/:n/2: c
>     return d
> ]
> game: does [
>     print "         Switching      Keeping"
>     prize: random 3
>     print ["Prize: " doors prize #"P" "  " doors prize #"P"]
>     guess: random 3
>     print ["Guess: " doors guess #"G" "  " doors guess #"G"]
>     opened: first random difference [1 2 3] reduce [prize guess]
>     prin ["Opened:" doors opened #"X"]
>     prin "     "
>     print either prize = guess [kept: kept + 1 "Win"]["Loss"]
>     sw: first difference [1 2 3] reduce [guess opened]
>     print ["Switch:" doors sw #"S"]
>     prin "         "
>     print either prize = sw [switched: switched + 1 "Win"]["Loss"]
> 
>     played: played + 1
>     print [
>         "Wins:   " switched "            "
>         kept 
>         "           Played:" played
>     ]
> ]
> played: 0
> kept: 0
> switched: 0
> quit?: false
> print ""
> while [not quit?][
>     game
>     print ""
>     print "Enter to continue - Esc to quit."
> 
>     inp: input
>     quit?: inp = "q"
> ]
> 
> 
> Enough! (:
> 
> -- 
> Carl Read
> 
> -- 
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the 
> subject, without the quotes.
> 
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to