Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: A Rebol Challenge. The Monty Hall Puzzle IN 0 BYTES

From: brett:codeconscious at: 19-Dec-2001 12:56

> But the goal is to not keep making the example shown with the C, MatLab,
> Pearl smaller, but to make a more verbose accurate portrayal of the
> puzzle in Rebol.
Here is a very verbose version of my original solution with Sunanda's explanation idea incorporated: REBOL [] box: [Box1 Box2 Box3] wins: 0 loop number-of-games: 100 [ pick-a: func [what] [copy/part random what 1] prize: pick-a box choice1: pick-a box remaining-box: exclude box opened-box: exclude box union prize choice1 choice2: pick-a remaining-box if win: equal? prize choice2 [ wins: wins + 1 ] print join "I choose " [ choice1 ". " opened-box " opened. I switch to " choice2 ". Prize in " prize ". I " either win ["win"]["lose"] "." ] ] print wins / number-of-games
> I'm then going to go see if they can do the same in Pearl, or language of > choice.
The choice of variable name is going to impact on the goal of the smallest verbose program. For this goal I believe one should use a meaningful name - something that does not require a legend to understand it immediately in it's own context. Brett.