[REBOL] Re: A Rebol Challenge. The Monty Hall Puzzle
From: g:santilli:tiscalinet:it at: 16-Dec-2001 15:27
Hello Reichart!
On 16-Dic-01, you wrote:
R> Does it matter if you switch?
Readable version:
random/seed now
no-switch-wins: 0
switch-wins: 0
loop 1000 [
winning: random 3
your-choice: random 3
either your-choice = winning [
no-switch-wins: no-switch-wins + 1
] [
switch-wins: switch-wins + 1
]
]
print [
"If you switch, you win" switch-wins "times" newline
"If you don't switch, you win" no-switch-wins "times"
]
Compact version:
r: does[random 3]n: s: 0 loop 1000[either r = r[n: n + 1][s: s + 1]]
print [
"If you switch, you win" s "times" newline
"If you don't switch, you win" n "times"
]
I presume the code you show is doing something different, but I
don't speak perl or matlab... :)
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/