knockabout.gamemodel
Class Die

java.lang.Object
  extended byknockabout.gamemodel.Die

public class Die
extends java.lang.Object

The Knockabout Die Class Represents a game die. Each game die has a set number of sides and color. Each die also has an (x,y) positional coordinate indicating it's position on a GameBoard. The current value will vary throughout the game, and range between 1 and the number of die sides.


Constructor Summary
Die(int _color, int _sides, int _curval)
          Note that no validation is done on any of these field.
 
Method Summary
 int curVal()
          Returns the current value of the game die.
 Die deepclone()
           
 int getColor()
          Returns the player's color code (see class Player) See class description about validation issues
 int getSides()
          Returns the number of sides on the die.
 int getX()
           
 int getY()
           
 void setVal(int _val)
           
 void setX(int i)
           
 void setY(int i)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Die

public Die(int _color,
           int _sides,
           int _curval)
Note that no validation is done on any of these field.

Parameters:
_color - The color code, see Player class
_sides - The number of sides on the die. MUST be one of {4, 6, 8} to conform the Board class fast acces fields
_curval - The current value on the die
Method Detail

curVal

public int curVal()
Returns the current value of the game die. See class description about validation issues


getSides

public int getSides()
Returns the number of sides on the die. See class description about validation issues


getColor

public int getColor()
Returns the player's color code (see class Player) See class description about validation issues


setVal

public void setVal(int _val)

deepclone

public Die deepclone()
Returns:
A clone of this die

getX

public int getX()
Returns:
x coord

getY

public int getY()
Returns:
y coord

setX

public void setX(int i)
Parameters:
i -

setY

public void setY(int i)
Parameters:
i -

toString

public java.lang.String toString()