edu.ucla.stat.SOCR.games
Class MontyHallGame
java.lang.Object
edu.ucla.stat.SOCR.core.SOCRValueSettable
edu.ucla.stat.SOCR.core.MultiplePartsPanel
edu.ucla.stat.SOCR.core.Game
edu.ucla.stat.SOCR.games.MontyHallGame
- All Implemented Interfaces:
- IGame, IValueSettable, Pluginable, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, java.util.Observer
public class MontyHallGame
- extends Game
- implements java.awt.event.ItemListener
This class models the famous Monty Hall game. A diamond is behind one door,
jockers are behind the other two. The player first chooses a door. Then the
host opens a different door. The player can stay with her original choice or
switch to the remaining door.
Constructor Summary |
MontyHallGame()
This method initializes the game, including the toolbar buttons, doors,
images |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent event)
This method handles the events for the Play button |
void |
itemStateChanged(java.awt.event.ItemEvent event)
This method handles the events for the host choice |
void |
mouseClicked(java.awt.event.MouseEvent event)
This method handles events for the door clicks |
void |
reset()
This message resets the game |
Methods inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel |
addGraph, addTable, addTool, addTool2, addToolbar, format, getMainPanel, getName, getRecordTable, getTextPanel, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, play, removeToolbar, setApplet, setName, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STANDARD
public static final int STANDARD
- See Also:
- Constant Field Values
BLIND
public static final int BLIND
- See Also:
- Constant Field Values
MontyHallGame
public MontyHallGame()
- This method initializes the game, including the toolbar buttons, doors,
images
reset
public void reset()
- This message resets the game
- Specified by:
reset
in interface IGame
- Overrides:
reset
in class Game
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- This method handles the events for the Play button
- Specified by:
actionPerformed
in interface java.awt.event.ActionListener
- Overrides:
actionPerformed
in class Game
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent event)
- This method handles the events for the host choice
- Specified by:
itemStateChanged
in interface java.awt.event.ItemListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent event)
- This method handles events for the door clicks
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
- Overrides:
mouseClicked
in class MultiplePartsPanel