All Packages Class Hierarchy This Package Previous Next Index
Class taxman.Game
java.lang.Object
|
+----taxman.Game
- public class Game
- extends Object
This is the control class for the game.
It has no UI logic and it's only job is to
send events to the various panels interested
in the game progress.
-
CPU_CHOSE
-
-
CPU_MOVE
-
-
DEF_CPU_FIRST
-
-
DEF_LOOK_AHEAD
-
-
DEF_NUMS_USED
-
-
DEF_RANDOM
-
-
DEF_SOUND_STATE
-
-
DEF_USE_CUTOFF
-
-
GAME_OVER
-
-
HUMAN_CHOSE
-
-
HUMAN_MOVE
-
-
NEW_GAME
-
-
OPTIONS_CLOSE
-
-
OPTIONS_OPEN
-
-
SOUND_OFF
-
-
SOUND_ON
-
-
Game()
- Constructor does nothing.
-
addPanel(GameUpdate)
- Adds a panel to be updated when the game state changes
-
changeOptionsScreen(boolean)
- A method to update panels when the options button is pressed.
-
makeCPUMove(int)
- Makes a move for the CPU and alternates control to the human
-
newGame(boolean)
- Control function to start a new game.
-
numberChosen(int)
- A panel can report that a number is chosen (by a human)
-
optionsChanged(boolean, int, int, boolean, boolean)
- Called by the option setting panel, this function changes game options.
HUMAN_MOVE
public static final int HUMAN_MOVE
CPU_MOVE
public static final int CPU_MOVE
HUMAN_CHOSE
public static final int HUMAN_CHOSE
CPU_CHOSE
public static final int CPU_CHOSE
NEW_GAME
public static final int NEW_GAME
GAME_OVER
public static final int GAME_OVER
OPTIONS_OPEN
public static final int OPTIONS_OPEN
OPTIONS_CLOSE
public static final int OPTIONS_CLOSE
SOUND_ON
public static final int SOUND_ON
SOUND_OFF
public static final int SOUND_OFF
DEF_NUMS_USED
public static final int DEF_NUMS_USED
DEF_RANDOM
public static final boolean DEF_RANDOM
DEF_CPU_FIRST
public static final boolean DEF_CPU_FIRST
DEF_LOOK_AHEAD
public static final int DEF_LOOK_AHEAD
DEF_USE_CUTOFF
public static final boolean DEF_USE_CUTOFF
DEF_SOUND_STATE
public static final boolean DEF_SOUND_STATE
Game
public Game()
- Constructor does nothing.
newGame
public synchronized void newGame(boolean first)
- Control function to start a new game.
- Parameters:
- first - true if the human should go first. false if the CPU goes first
numberChosen
public synchronized void numberChosen(int n)
- A panel can report that a number is chosen (by a human)
- Parameters:
- n - the number that was chosen
optionsChanged
public synchronized void optionsChanged(boolean a_b,
int max_levels,
int quantity,
boolean random,
boolean sound)
- Called by the option setting panel, this function changes game options.
Changing options will require a new game so the panel listing options
should be de-activated during game play.
- Parameters:
- a_b - flag indicating whether alpha/beta pruning should be used (default = true)
- max_levels - number of look-ahead levels for the CPU to search
- quantity - the quantity of numbers to put in the game
- random - whether or not to use random numbers (otherwise they are sequential
- sound - True if the sound is turned on
changeOptionsScreen
public synchronized void changeOptionsScreen(boolean optionsOpening)
- A method to update panels when the options button is pressed.
- Parameters:
- optionsOpening - true if the options dialog is opening, false if it is closing
makeCPUMove
public synchronized void makeCPUMove(int n)
- Makes a move for the CPU and alternates control to the human
- Parameters:
- n - The number the CPU chose (in a different thread)
addPanel
public void addPanel(GameUpdate panel)
- Adds a panel to be updated when the game state changes
- Parameters:
- panel - The panel (using the interface - GameUpdate) that wants
to know when the game state changes.
All Packages Class Hierarchy This Package Previous Next Index