<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Let&#8217;s Make A Deal!</title>
	<atom:link href="http://programmingpraxis.com/2009/07/24/lets-make-a-deal/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/</link>
	<description>A collection of etudes, updated weekly, for the education and enjoyment of the savvy programmer</description>
	<lastBuildDate>Sat, 11 Feb 2012 09:48:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Diego Giuliani</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-4105</link>
		<dc:creator><![CDATA[Diego Giuliani]]></dc:creator>
		<pubDate>Tue, 27 Dec 2011 16:39:43 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-4105</guid>
		<description><![CDATA[[sourcecode lang=&quot;python&quot;]
# Monty Hall Paradox simulation / Let&#039;s make a deal
# Simulates a number of games and output the total number of wins and looses,
# and the percentage of each, to determine if switching doors after the host has opened one
# is a better option.

from random import random,randint

def scrambleDoors(doors):
    &quot;&quot;&quot;
    Simulates the scramble of doors by choosing one to contain a Car instead of a Goat
    &quot;&quot;&quot;
    doors[randint(1,3)] = &quot;Car&quot;
    return doors
    
def pick():
    &quot;&quot;&quot;
    Choose a door between 1 and 3
    &quot;&quot;&quot;
    return int(random() * 100) % 3 + 1
        
def openDoor(door_list,door):
    &quot;&quot;&quot;
    The host opens a door, wich must not reveal the price, and also is not the one the player has choosen    
    &quot;&quot;&quot;
    return [i for i in door_list.keys() if (door_list[i] != &quot;Car&quot;) &amp; (i != door)][0]
    
def switchDoor(door_list,door):
    return [i for i in door_list.keys() if i != door]


def play():   
   # 1 - Scramble doors   
   doors = scrambleDoors({1:&quot;Goat&quot;,2:&quot;Goat&quot;,3:&quot;Goat&quot;})
   
   # 2 - Pick a door
   door = pick()
   
   # 3 - Open a door, and remove it from door list 
   od = openDoor(doors,door)
   del doors[od]

   # 4 - Switch door
   newDoor = switchDoor(doors,door)
   
   # 5 - Won?
   return doors[newDoor[0]] == &quot;Car&quot;
   
def game(n = 100):    
    &quot;&quot;&quot; 
    n: Number of games to simulate
    &quot;&quot;&quot;
    
    win = 0
    loose = 0
    for i in range(0,n):
        if (play()):
            win +=1
        else:
            loose += 1
    porcWin = (float(win) / n) *  100
    porcLoose = (float(loose) / n) *  100
    print &quot;&quot;&quot;
        Runs  : % s
        Win   : %s  Percentage win  : %s
        Loose : %s  Percentage Loose: %s
        &quot;&quot;&quot; % (n,win,porcWin, loose,porcLoose)
[/sourcecode]
Which produces the following output
[sourcecode lang=&quot;python&quot;]
Runs  : 1000
Win   : 680  Percentage win  : 68.0
Loose : 320  Percentage Loose: 32.0
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<pre class="brush: python;">
# Monty Hall Paradox simulation / Let's make a deal
# Simulates a number of games and output the total number of wins and looses,
# and the percentage of each, to determine if switching doors after the host has opened one
# is a better option.

from random import random,randint

def scrambleDoors(doors):
    &quot;&quot;&quot;
    Simulates the scramble of doors by choosing one to contain a Car instead of a Goat
    &quot;&quot;&quot;
    doors[randint(1,3)] = &quot;Car&quot;
    return doors

def pick():
    &quot;&quot;&quot;
    Choose a door between 1 and 3
    &quot;&quot;&quot;
    return int(random() * 100) % 3 + 1

def openDoor(door_list,door):
    &quot;&quot;&quot;
    The host opens a door, wich must not reveal the price, and also is not the one the player has choosen
    &quot;&quot;&quot;
    return [i for i in door_list.keys() if (door_list[i] != &quot;Car&quot;) &amp; (i != door)][0]

def switchDoor(door_list,door):
    return [i for i in door_list.keys() if i != door]

def play():
   # 1 - Scramble doors
   doors = scrambleDoors({1:&quot;Goat&quot;,2:&quot;Goat&quot;,3:&quot;Goat&quot;})

   # 2 - Pick a door
   door = pick()

   # 3 - Open a door, and remove it from door list
   od = openDoor(doors,door)
   del doors[od]

   # 4 - Switch door
   newDoor = switchDoor(doors,door)

   # 5 - Won?
   return doors[newDoor[0]] == &quot;Car&quot;

def game(n = 100):
    &quot;&quot;&quot;
    n: Number of games to simulate
    &quot;&quot;&quot;

    win = 0
    loose = 0
    for i in range(0,n):
        if (play()):
            win +=1
        else:
            loose += 1
    porcWin = (float(win) / n) *  100
    porcLoose = (float(loose) / n) *  100
    print &quot;&quot;&quot;
        Runs  : % s
        Win   : %s  Percentage win  : %s
        Loose : %s  Percentage Loose: %s
        &quot;&quot;&quot; % (n,win,porcWin, loose,porcLoose)
</pre>
<p>Which produces the following output</p>
<pre class="brush: python;">
Runs  : 1000
Win   : 680  Percentage win  : 68.0
Loose : 320  Percentage Loose: 32.0
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg R</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-442</link>
		<dc:creator><![CDATA[Greg R]]></dc:creator>
		<pubDate>Thu, 13 Aug 2009 12:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-442</guid>
		<description><![CDATA[I made an attempt in PL/SQL (Oracle). I made the number of doors configurable (assuming that the host opens all doors except yours or the prize, or a random single door if you have chosen the prize door initially).

[sourcecode lang=&#039;sql&#039;]
declare
  Runs  integer := 10000;
  Doors integer := 3;

  function RunMonteHaul
  (
  Runs    in  integer,
  MaxDoor in  integer,
  Swap    in  boolean
  )
  return integer
  is
    Prize     integer;
    OtherDoor integer;
    MyDoor    integer;
    Wins      integer := 0;
    i integer;
    j integer;
  begin
  
    for i in 1 .. Runs loop
      Prize := dbms_random.value(1,MaxDoor);
      MyDoor := dbms_random.value(1,MaxDoor);
      if Prize = MyDoor then
        if Prize = MaxDoor then
          OtherDoor := 1;
        else
          OtherDoor := MaxDoor;
        end if;
      else
        OtherDoor := Prize;
      end if;
      if Swap then
        MyDoor := OtherDoor;
      end if;
      if MyDoor = Prize then
        Wins := Wins + 1;
      end if;
    end loop;
    return Wins;
  end RunMonteHaul;
begin        
    dbms_output.put_line(&#039;Runs  &#039; &#124;&#124; Runs);
    dbms_output.put_line(&#039;Doors &#039; &#124;&#124; Doors);
    dbms_output.put_line(&#039;Swap Wins    &#039; &#124;&#124; RunMonteHaul(Runs,Doors,true));
    dbms_output.put_line(&#039;No Swap Wins &#039; &#124;&#124; RunMonteHaul(Runs,Doors,false));
end;

[/sourcecode]

This produces the output

[sourcecode lang=&#039;sql&#039;]
Runs  10000
Doors 3
Swap Wins    6290
No Swap Wins 3725

Runs  10000
Doors 10000
Swap Wins    9999
No Swap Wins 1
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>I made an attempt in PL/SQL (Oracle). I made the number of doors configurable (assuming that the host opens all doors except yours or the prize, or a random single door if you have chosen the prize door initially).</p>
<pre class="brush: sql;">
declare
  Runs  integer := 10000;
  Doors integer := 3;

  function RunMonteHaul
  (
  Runs    in  integer,
  MaxDoor in  integer,
  Swap    in  boolean
  )
  return integer
  is
    Prize     integer;
    OtherDoor integer;
    MyDoor    integer;
    Wins      integer := 0;
    i integer;
    j integer;
  begin

    for i in 1 .. Runs loop
      Prize := dbms_random.value(1,MaxDoor);
      MyDoor := dbms_random.value(1,MaxDoor);
      if Prize = MyDoor then
        if Prize = MaxDoor then
          OtherDoor := 1;
        else
          OtherDoor := MaxDoor;
        end if;
      else
        OtherDoor := Prize;
      end if;
      if Swap then
        MyDoor := OtherDoor;
      end if;
      if MyDoor = Prize then
        Wins := Wins + 1;
      end if;
    end loop;
    return Wins;
  end RunMonteHaul;
begin
    dbms_output.put_line('Runs  ' || Runs);
    dbms_output.put_line('Doors ' || Doors);
    dbms_output.put_line('Swap Wins    ' || RunMonteHaul(Runs,Doors,true));
    dbms_output.put_line('No Swap Wins ' || RunMonteHaul(Runs,Doors,false));
end;
</pre>
<p>This produces the output</p>
<pre class="brush: sql;">
Runs  10000
Doors 3
Swap Wins    6290
No Swap Wins 3725

Runs  10000
Doors 10000
Swap Wins    9999
No Swap Wins 1
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Let’s Make A Deal! « Programming Praxis &#124; what a gloomy day..</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-425</link>
		<dc:creator><![CDATA[Let’s Make A Deal! « Programming Praxis &#124; what a gloomy day..]]></dc:creator>
		<pubDate>Tue, 04 Aug 2009 16:46:38 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-425</guid>
		<description><![CDATA[[...] Let’s Make A Deal! « Programming Praxis. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Let’s Make A Deal! « Programming Praxis. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Everett</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-410</link>
		<dc:creator><![CDATA[Brian Everett]]></dc:creator>
		<pubDate>Thu, 30 Jul 2009 19:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-410</guid>
		<description><![CDATA[I&#039;m just now learning Python and figured I&#039;d play around with its list capabilities for this one...

Originally I was using list comprehension to generate a list of random numbers (to indicate which door the car is behind) and keeping the contestant&#039;s choice constant (always picking door number 1), but I realized it might be slightly faster to randomize the contestant&#039;s choice and assume the car is always located behind door number 1 - simply using the list as a looping mechanism.

[sourcecode lang=&#039;python&#039;]
import random
trials = 100000
print &quot;Switching will win: %2.2f%% of the time&quot; % (len(filter(lambda trial: random.randint(1, 3) != 1, xrange(trials))) / float(trials) * 100)
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m just now learning Python and figured I&#8217;d play around with its list capabilities for this one&#8230;</p>
<p>Originally I was using list comprehension to generate a list of random numbers (to indicate which door the car is behind) and keeping the contestant&#8217;s choice constant (always picking door number 1), but I realized it might be slightly faster to randomize the contestant&#8217;s choice and assume the car is always located behind door number 1 &#8211; simply using the list as a looping mechanism.</p>
<pre class="brush: python;">
import random
trials = 100000
print "Switching will win: %2.2f%% of the time" % (len(filter(lambda trial: random.randint(1, 3) != 1, xrange(trials))) / float(trials) * 100)
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paulo Jorge Matos</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-409</link>
		<dc:creator><![CDATA[Paulo Jorge Matos]]></dc:creator>
		<pubDate>Mon, 27 Jul 2009 10:37:29 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-409</guid>
		<description><![CDATA[I suggest also reading a nice treatment of this exact problem in &quot;The man who loved only numbers&quot; by Paul Hoffman.]]></description>
		<content:encoded><![CDATA[<p>I suggest also reading a nice treatment of this exact problem in &#8220;The man who loved only numbers&#8221; by Paul Hoffman.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Gimblett</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-395</link>
		<dc:creator><![CDATA[Andy Gimblett]]></dc:creator>
		<pubDate>Fri, 24 Jul 2009 23:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-395</guid>
		<description><![CDATA[My Haskell version: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=7478#a7478

Lots of fun - thanks!

-Andy]]></description>
		<content:encoded><![CDATA[<p>My Haskell version: <a href="http://hpaste.org/fastcgi/hpaste.fcgi/view?id=7478#a7478" rel="nofollow">http://hpaste.org/fastcgi/hpaste.fcgi/view?id=7478#a7478</a></p>
<p>Lots of fun &#8211; thanks!</p>
<p>-Andy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark VandeWettering KF6KYI</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-394</link>
		<dc:creator><![CDATA[Mark VandeWettering KF6KYI]]></dc:creator>
		<pubDate>Fri, 24 Jul 2009 22:13:18 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-394</guid>
		<description><![CDATA[Ugly, but it works.

[sourcecode lang=&quot;python&quot;]
#!/usr/bin/env python

# code for the monty hall problem
# written by Mark VandeWettering as a challenge on
# the programming praxis website.

import random

NTRIALS=10000

def trial(switch=False):
        # pick a random door...
        door = random.randint(1, 3)
        guess = random.randint(1, 3)
        if not switch:
            return door == guess
        else:
            # slightly clever, but the only way that you
            # lose is if you were lucky enough (or unlucky
            # enough) to guess the right door in the first
            # place.   This gives away the entire problem.
            return door != guess

cnt_noswitch = 0
cnt_switch = 0

for x in range(NTRIALS):
    if trial():
        cnt_noswitch = cnt_noswitch + 1
    if trial(switch=True):
        cnt_switch = cnt_switch + 1

print &quot;By not switching, you won %d/%d rounds.&quot; % (cnt_noswitch, NTRIALS)
print &quot;By switching, you won %d/%d rounds.&quot; % (cnt_switch, NTRIALS)
if cnt_switch &gt; cnt_noswitch:
        print &quot;It appears you should switch.&quot;
else:
        print &quot;It appears you should not switch.&quot;
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>Ugly, but it works.</p>
<pre class="brush: python;">
#!/usr/bin/env python

# code for the monty hall problem
# written by Mark VandeWettering as a challenge on
# the programming praxis website.

import random

NTRIALS=10000

def trial(switch=False):
        # pick a random door...
        door = random.randint(1, 3)
        guess = random.randint(1, 3)
        if not switch:
            return door == guess
        else:
            # slightly clever, but the only way that you
            # lose is if you were lucky enough (or unlucky
            # enough) to guess the right door in the first
            # place.   This gives away the entire problem.
            return door != guess

cnt_noswitch = 0
cnt_switch = 0

for x in range(NTRIALS):
    if trial():
        cnt_noswitch = cnt_noswitch + 1
    if trial(switch=True):
        cnt_switch = cnt_switch + 1

print &quot;By not switching, you won %d/%d rounds.&quot; % (cnt_noswitch, NTRIALS)
print &quot;By switching, you won %d/%d rounds.&quot; % (cnt_switch, NTRIALS)
if cnt_switch &gt; cnt_noswitch:
        print &quot;It appears you should switch.&quot;
else:
        print &quot;It appears you should not switch.&quot;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie Hope</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-393</link>
		<dc:creator><![CDATA[Jamie Hope]]></dc:creator>
		<pubDate>Fri, 24 Jul 2009 13:57:31 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-393</guid>
		<description><![CDATA[I already knew that the correct answer is the probability of winning by switching is 2/3, but:
[sourcecode lang=&#039;css&#039;]
#!r6rs

(import (rnrs)
        (srfi :27))

(define (create-game) ; false = goat, true = car
  (let ((v (make-vector 3 #f)))
    (vector-set! v (random-integer 3) #t)
    v))

(define (player-choice) (random-integer 3))

(define (host-choice g p) ; host always chooses a goat
  (case p
    ((0) (if (vector-ref g 1) 2 1))
    ((1) (if (vector-ref g 0) 2 0))
    ((2) (if (vector-ref g 0) 1 0))))

(define (switch p h)
  (case (+ p h)
    ((1) 2)
    ((2) 1)
    ((3) 0)))

(define (run-test n)
  (let loop ((wins 0) (total 0))
    (if (= total n) (/ wins total)
        (let* ((g (create-game))
               (p (player-choice))
               (h (host-choice g p))
               (s (switch p h)))
          (if (vector-ref g s)
              (loop (+ wins 1) (+ total 1))
              (loop wins (+ total 1)))))))

(display (inexact (run-test 1000000)))
[/sourcecode]
=&gt; 0.66756]]></description>
		<content:encoded><![CDATA[<p>I already knew that the correct answer is the probability of winning by switching is 2/3, but:</p>
<pre class="brush: css;">
#!r6rs

(import (rnrs)
        (srfi :27))

(define (create-game) ; false = goat, true = car
  (let ((v (make-vector 3 #f)))
    (vector-set! v (random-integer 3) #t)
    v))

(define (player-choice) (random-integer 3))

(define (host-choice g p) ; host always chooses a goat
  (case p
    ((0) (if (vector-ref g 1) 2 1))
    ((1) (if (vector-ref g 0) 2 0))
    ((2) (if (vector-ref g 0) 1 0))))

(define (switch p h)
  (case (+ p h)
    ((1) 2)
    ((2) 1)
    ((3) 0)))

(define (run-test n)
  (let loop ((wins 0) (total 0))
    (if (= total n) (/ wins total)
        (let* ((g (create-game))
               (p (player-choice))
               (h (host-choice g p))
               (s (switch p h)))
          (if (vector-ref g s)
              (loop (+ wins 1) (+ total 1))
              (loop wins (+ total 1)))))))

(display (inexact (run-test 1000000)))
</pre>
<p>=&gt; 0.66756</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cwbowron</title>
		<link>http://programmingpraxis.com/2009/07/24/lets-make-a-deal/#comment-392</link>
		<dc:creator><![CDATA[cwbowron]]></dc:creator>
		<pubDate>Fri, 24 Jul 2009 13:25:18 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1037#comment-392</guid>
		<description><![CDATA[[sourcecode lang=&#039;cpp&#039;]
#lang scheme

(define DOOR-COUNT 3)

(define (car? n lst) (eq? (list-ref lst n) &#039;car))

(define (get-door-layout n)
  (let loop ([n n] [doors (list)])
    (cond
      [(= 0 n) doors]
      [(or (member &#039;car doors)
           (not (= 0 (random n))))
       (loop (sub1 n) (cons &#039;goat doors))]
      [else 
       (loop (sub1 n) (cons &#039;car doors))])))

(define (get-random-door door-count criteria-function)
  (let ([door (random door-count)])
    (if (criteria-function door) 
        door 
        (get-random-door door-count criteria-function))))

(define (get-revealed-door doors contestant-selection)
  (get-random-door (length doors) 
                   (lambda (n)
                     (and (not (= n contestant-selection))
                          (eq? (list-ref doors n) &#039;goat)))))

(define (get-switch-door door-count unavailable-doors)
  (get-random-door door-count (lambda (n) (not (member n unavailable-doors)))))

(define (make-a-deal n (show-debug-info #f))
  (let ([success-count-stick 0]
        [success-count-switch 0])
    (for ((trial (in-range n)))
      (let ([doors (get-door-layout DOOR-COUNT)]
            [selected-door (random DOOR-COUNT)])
        (let ([revealed-door (get-revealed-door doors selected-door)])
          (let ([selected-door-switch (get-switch-door DOOR-COUNT (list selected-door revealed-door))])
            (when show-debug-info
              (printf &quot;DOORS: ~A~%&quot; doors)
              (printf &quot;SELECTED DOOR: ~A~%&quot; selected-door)
              (printf &quot;REVEALED DOOR: ~A~%&quot; revealed-door)
              (printf &quot;SWITCH DOOR: ~A~%&quot; selected-door-switch))
            (cond [(car? selected-door doors)
                   (set! success-count-stick (add1 success-count-stick))]
                  [(car? selected-door-switch doors)
                   (set! success-count-switch (add1 success-count-switch))])))))
    (printf &quot;Success Rate of Sticking:  ~A%~%&quot; (exact-&gt;inexact (* 100 (/ success-count-stick n))))
    (printf &quot;Success Rate of Switching: ~A%~%&quot; (exact-&gt;inexact (* 100 (/ success-count-switch n))))
    (if (&gt; success-count-switch success-count-stick)
        (printf &quot;Better off Switching~%&quot;)
        (printf &quot;Better off Sticking~%&quot;))))

(make-a-deal 100000)
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<pre class="brush: cpp;">
#lang scheme

(define DOOR-COUNT 3)

(define (car? n lst) (eq? (list-ref lst n) 'car))

(define (get-door-layout n)
  (let loop ([n n] [doors (list)])
    (cond
      [(= 0 n) doors]
      [(or (member 'car doors)
           (not (= 0 (random n))))
       (loop (sub1 n) (cons 'goat doors))]
      [else
       (loop (sub1 n) (cons 'car doors))])))

(define (get-random-door door-count criteria-function)
  (let ([door (random door-count)])
    (if (criteria-function door)
        door
        (get-random-door door-count criteria-function))))

(define (get-revealed-door doors contestant-selection)
  (get-random-door (length doors)
                   (lambda (n)
                     (and (not (= n contestant-selection))
                          (eq? (list-ref doors n) 'goat)))))

(define (get-switch-door door-count unavailable-doors)
  (get-random-door door-count (lambda (n) (not (member n unavailable-doors)))))

(define (make-a-deal n (show-debug-info #f))
  (let ([success-count-stick 0]
        [success-count-switch 0])
    (for ((trial (in-range n)))
      (let ([doors (get-door-layout DOOR-COUNT)]
            [selected-door (random DOOR-COUNT)])
        (let ([revealed-door (get-revealed-door doors selected-door)])
          (let ([selected-door-switch (get-switch-door DOOR-COUNT (list selected-door revealed-door))])
            (when show-debug-info
              (printf &quot;DOORS: ~A~%&quot; doors)
              (printf &quot;SELECTED DOOR: ~A~%&quot; selected-door)
              (printf &quot;REVEALED DOOR: ~A~%&quot; revealed-door)
              (printf &quot;SWITCH DOOR: ~A~%&quot; selected-door-switch))
            (cond [(car? selected-door doors)
                   (set! success-count-stick (add1 success-count-stick))]
                  [(car? selected-door-switch doors)
                   (set! success-count-switch (add1 success-count-switch))])))))
    (printf &quot;Success Rate of Sticking:  ~A%~%&quot; (exact-&gt;inexact (* 100 (/ success-count-stick n))))
    (printf &quot;Success Rate of Switching: ~A%~%&quot; (exact-&gt;inexact (* 100 (/ success-count-switch n))))
    (if (&gt; success-count-switch success-count-stick)
        (printf &quot;Better off Switching~%&quot;)
        (printf &quot;Better off Sticking~%&quot;))))

(make-a-deal 100000)
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

