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

From: brett:codeconscious at: 17-Dec-2001 0:33

Hi Reichart, The one is not as wonderous as Sunanda's solution but is interesting because you can use whatever symbols you like to represent the boxes :) The code below simulates the always switch strategy - returns rough probability of winning: REBOL[] d: {123}w: 0 loop n: 500 [ p: func[s][copy/part random s 1] b: p d c: p d if b = p union b c [w: w + 1]] w / n d: represents the choices - could have been any series of 3 elements e.g [box1 box2 box3] p: makes a random selection from a series b: the winning box c: the first choice (union b c) is equivalent to the two closed boxes after monty has opened one empty box That is it is equivalent too box-to-remove: exclude d union b c choices: exclude d box-to-remove An anxious person would probably figure out they'd more than likely goofed first go :) Cheers Brett.