Lab 1: Let's Make a Deal

Quite often computer programs are written to compute values experimentally that may be difficult to calculate otherwise. Computer programs also may be written to simulate some process in order to evaluate the process before investing in a costly implementation. A simulation program should provide appropriate data to be analyzed so that decisions can be reached.

OBJECTIVE

  1. To begin learning how to evaluate and test your own code.
  2. To begin learning to choose and effectively display appropriate data to analyze an algorithm.

THE GAME

For the Big Deal of the Day on the Let's Make A Deal game show, Monty Hall chooses two contestants. There is a grand prize, a second prize, and a third prize behind the three curtains. The second prize and third prize are close in value and therefore indistinguishable to the contestants. Monty selects two players at the end of the game, has them each pick a curtain (they must choose different curtains), and then opens the player's curtain that is the least value of the two chosen curtains. Then Monty gives the remaining player the chance to switch to the unchosen curtain. The question we ask is ''should that player switch?''

ASSIGNMENT

Part 1: Implement two versions of the same program simulating the Let's Make a Deal Show.

  1. First have the grand, second, and third prizes distributed randomly (note their are six permutations; each should be equally likely).
  2. Have the first player choose from the three curtains, and the second player choose randomly from the two remaining curtains (make sure the second player does not choose the same curtain as the first player.)
  3. Have Monty determine which of the two players' curtains should be opened. Monty does not open the winning curtain. Monty does not open the unchosen curtain.
  4. Determine whether the curtain should be switched or not.
Jane, Betty, Frank, and Fred are frequent members of the audience. They shout their recommendations to the contestant who is asked whether to ``keep a curtain'' or "switch."

Jane's Stategy

Jane always shouts "SWITCH".

Betty's Stategy

Betty always shouts "NO.. DON'T SWITCH"

Frank's Strategy

Frank always tries to guess the number of the winning curtain randomly before he enters the audience. If the player has chosen that curtain, Frank shouts "NO.. DON'T SWITCH." On the other hand, if the player has chosen a different curtain, Frank shouts "SWITCH," (even if Monty has opened Frank's curtain).

Fred's Stategy

If it is the first contestant that is given the choice, then Fred shouts "NO.. DON'T SWITCH". If it is the second contestant, then Fred shouts "SWITCH"

Versions of the Program

  1. Version 1: Simulate the game show. Put plenty of commentary (output) in your program, giving a running account of what is happening. (Be sure to run your program enough times to see that it is behaving correctly.) Please make sure that Monty initially does not open the winning door or the initially unchosen door.

    Behind the scenes...
    Curtain 1: grand prize   Curtain 2: third prize   Curtain 3: second prize
    
    The first contestant picks curtain 2.
    The second contestant picks curtain 3.
    Monty opens curtain 2.
    Monty gives the second contestant the chance to switch from curtain 3 to 
    curtain 1.  
    
    Jane shouts the contestant should switch.
    Jane is right.
    
    Betty shouts the contestant should not switch.
    Betty is wrong.
    
    Before the show, Frank chose curtain 2.
    Frank shouts the contestant should switch.
    Frank is right.
    
    Fred shouts the contestant should switch.
    Fred is right.
    
    -------------------------------------------------------
    Behind the scenes...
    Curtain 1: grand prize   Curtain 2: second prize   Curtain 3: third prize
    
    The first contestant picks curtain 2.
    The second contestant picks curtain 3.
    Monty opens curtain 3.
    Monty gives the first contestant the chance to switch from curtain 2 to 
    curtain 1.  
    
    Jane shouts the contestant should switch.
    Jane is right.
    
    Betty shouts the contestant should not switch.
    Betty is wrong.
    
    Before the show, Frank chose curtain 1.
    Frank shouts the contestant should switch.
    Frank is right.
    
    Fred shouts the contestant should not switch.
    Fred is wrong.
    
    --------------------------------------------------------
    Behind the scenes...
    Curtain 1: third prize   Curtain 2: grand prize   Curtain 3: second prize
    
    The first contestant picks curtain 1.
    The second contestant picks curtain 2.
    Monty opens curtain 1.
    Monty gives the second contestant the chance to switch from curtain 2 to 
    curtain 3.  
    
    Jane shouts the contestant should switch.
    Jane is wrong.
    
    Betty shouts the contestant should not switch.
    Betty is right.
    
    Before the show, Frank chose curtain 1.
    Frank shouts the contestant should switch.
    Frank is wrong.
    
    Fred shouts the contestant should switch.
    Fred is wrong.
    
    --------------------------------------------------------
    Behind the scenes...
    Curtain 1: second prize   Curtain 2: third prize   Curtain 3: grand prize
    
    The first contestant picks curtain 1.
    The second contestant picks curtain 3.
    Monty opens curtain 1.
    Monty gives the second contestant the chance to switch from curtain 3 to 
    curtain 2.  
    
    Jane shouts the contestant should switch.
    Jane is wrong.
    
    Betty shouts the contestant should not switch.
    Betty is right.
    
    Before the show, Frank chose curtain 3.
    Frank shouts the contestant should not switch.
    Frank is right.
    
    Fred shouts the contestant should switch.
    Fred is wrong.
    ---------------------------------------------------------------
    
  2. Version 2: (Either make a new program for this version or allow a menu to choose between the versions). In the new version, the commentary is removed. Put the game in a loop, running your simulation 1,000 times. You may either run each player separately, or you may run the simulation 1000 times, computing the result of each run for all four player. Make sure that each time a random curtain should be chosen. If you use a Random object, create just one random object and re-use it (instead of repeatedly making new Random objects). This Random object may be a static field if you choose.

Part 2. Analysis and Lab Report

  1. Turn in a lab report. The lab report should discuss briefly the problem that is being studied, discuss briefly the experiment that was carried out by the computer, an appropriate chart of the results of the experiment in an informative format, and a conclusion about the strategies. Make a comment about the 1,000 trials (was that a good number.)

DELIVERABLES

Submit your program and lab report, including at least one chart. Your lab will be graded on program correctness, program form and documentation, and content and style of the lab report. The report should be typed. This is due on Wednesday, August 26th, by 11:55pm.