net.bluebones.boggle
Class Die

java.lang.Object
  extended by net.bluebones.boggle.Die

public class Die
extends Object

Represents a Boggle die (with letters on each face).

Version:
0.3 $Revision: 1.3 $, 2004-09-04
Author:
bakert@gmail.com>

Field Summary
static Die[] dice
           
static Die[] dice16
          The set of dice used to play the 4x4 game.
static Die[] dice25
          The set of dice used to play the 5x5 game.
 
Constructor Summary
Die(char[] faces)
          Initialises this die with the specified faces.
 
Method Summary
 char getFace(int face)
          Gets the char that is on the specified face of this die.
 char getRandomFace()
          Gets a face from this die at random (simulates rolling it).
static Die[][] rollDice(Die[] dice)
          "Shakes" the supplied dice into a random order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dice16

public static Die[] dice16
The set of dice used to play the 4x4 game.


dice25

public static Die[] dice25
The set of dice used to play the 5x5 game.


dice

public static Die[] dice
Constructor Detail

Die

public Die(char[] faces)
Initialises this die with the specified faces.

Parameters:
faces - chars that appear on this die's faces. Any number of faces is allowed and all dice in the game need not have the same number.
Method Detail

getFace

public char getFace(int face)
Gets the char that is on the specified face of this die.

Parameters:
face - The face to get the char from.
Returns:
char that appears on the specified face.

rollDice

public static Die[][] rollDice(Die[] dice)
"Shakes" the supplied dice into a random order.

Parameters:
dice - Dice to shake.
Returns:
Array of dice in a random order.

getRandomFace

public char getRandomFace()
Gets a face from this die at random (simulates rolling it).

Returns:
char value found on a random face of this die.