edu.ucla.stat.SOCR.experiments
Class MontyHallExperiment

java.lang.Object
  extended by edu.ucla.stat.SOCR.core.SOCRValueSettable
      extended by edu.ucla.stat.SOCR.core.MultiplePartsPanel
          extended by edu.ucla.stat.SOCR.core.Experiment
              extended by edu.ucla.stat.SOCR.experiments.MontyHallExperiment
All Implemented Interfaces:
IExperiment, IValueSettable, Pluginable, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.lang.Runnable, java.util.EventListener, java.util.Observer

public class MontyHallExperiment
extends Experiment

This class models the famous Monty Hall experiment. There are three doors; a diamond is behind one, jockers are behind the other two. The player selects a door and then the host opens another door. The player is given the option of keeping her original choice or switching to the other unopened door.


Nested Class Summary
 
Nested classes/interfaces inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
MultiplePartsPanel.SOCRToolBar
 
Field Summary
static int BLIND
           
static int STANDARD
           
 
Fields inherited from class edu.ucla.stat.SOCR.core.Experiment
showModelDistribution
 
Fields inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
applet, fName, graphs, mainPane, recordTable, tables, toolbar2, toolbars
 
Constructor Summary
MontyHallExperiment()
          This method initializes the experiment, including the toolbar with the drop down boxes and scrollbar, the random variable table and graph, the record table, and the doors.
 
Method Summary
 void doExperiment()
          This method defines the experiment.
 void itemStateChanged(java.awt.event.ItemEvent event)
          This method handles the choice event that determines whether the host follows the standard strategy or the blind strategy
 void reset()
          This method resets the experiment, including the record table, the doors, the random variable graph and table, and the record table
 void setDistribution()
          This method sets the parameters of the win distribution, when the parameters of the experiment have changed.
 void step()
          This method runs the experiment one time, and plays a sound depending on the outcome
 void update()
          This method updates the displays, including the record table, the doors, the random variable graph and table, and the record table
 void update(java.util.Observable o, java.lang.Object arg)
          This method handles the scrollbar event for adjusting the probability of switching
 
Methods inherited from class edu.ucla.stat.SOCR.core.Experiment
actionPerformed, getAppletInfo, getDisplayPane, getInstance, getName, getOnlineDescription, getResultTable, getStopChoice, getStopFreq, getTime, getUpdateChoice, graphUpdate, initialize, pasteData, resetUpdateCount, run, setShowModelDistribution, setStopFreq, setStopNow, stop
 
Methods inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
addGraph, addTable, addTool, addTool2, addToolbar, format, getMainPanel, getRecordTable, getTextPanel, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, play, removeToolbar, setApplet, setName
 
Methods inherited from class edu.ucla.stat.SOCR.core.SOCRValueSettable
createComponentSetter, createValueSetter, createValueSetter, createValueSetter, createValueSetter, getComponentSetter, getComponentSetters, getValueSetter, getValueSetters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.ucla.stat.SOCR.core.Pluginable
setApplet
 

Field Detail

STANDARD

public static final int STANDARD
See Also:
Constant Field Values

BLIND

public static final int BLIND
See Also:
Constant Field Values
Constructor Detail

MontyHallExperiment

public MontyHallExperiment()
This method initializes the experiment, including the toolbar with the drop down boxes and scrollbar, the random variable table and graph, the record table, and the doors.

Method Detail

doExperiment

public void doExperiment()
This method defines the experiment. The diamond is placed behind a randomly chosen door and then the player chooses a door at random. The host opens one of the two doors not chosen by the player.

Specified by:
doExperiment in interface IExperiment
Overrides:
doExperiment in class Experiment

reset

public void reset()
This method resets the experiment, including the record table, the doors, the random variable graph and table, and the record table

Specified by:
reset in interface IExperiment
Overrides:
reset in class Experiment

update

public void update()
This method updates the displays, including the record table, the doors, the random variable graph and table, and the record table

Specified by:
update in interface IExperiment
Overrides:
update in class Experiment

step

public void step()
This method runs the experiment one time, and plays a sound depending on the outcome

Specified by:
step in interface IExperiment
Overrides:
step in class Experiment

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
This method handles the scrollbar event for adjusting the probability of switching

Specified by:
update in interface java.util.Observer
Overrides:
update in class MultiplePartsPanel

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
This method handles the choice event that determines whether the host follows the standard strategy or the blind strategy

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Overrides:
itemStateChanged in class Experiment

setDistribution

public void setDistribution()
This method sets the parameters of the win distribution, when the parameters of the experiment have changed.