uk.co.triplesix.craps
Class Game

java.lang.Object
  extended by uk.co.triplesix.craps.Game

public class Game
extends java.lang.Object

The main game logic for Craps

Author:
Karl Smith

Constructor Summary
Game()
          Set the initial state of the game to "not running".
 
Method Summary
 boolean isRunning()
          Check the game's current state
 void processGame()
          The main game loop for Craps.
 int rollDice(int numberOfDice, int numberOfSides)
          Generate a random number emulating the roll of a dice
 void showInstructions()
          Print the game instructions to the screen.
 void startGame()
          Sets the game's state to running.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Game

public Game()
Set the initial state of the game to "not running". Instantiate a new Player class.

Method Detail

rollDice

public int rollDice(int numberOfDice,
                    int numberOfSides)
Generate a random number emulating the roll of a dice

Parameters:
numberOfDice - The number of "dice" to roll
numberOfSides - The number of sides on each "dice"
Returns:
The total score rolled by the "dice"

showInstructions

public void showInstructions()
Print the game instructions to the screen.


isRunning

public boolean isRunning()
Check the game's current state

Returns:
True if the game is running. False if it is not

startGame

public void startGame()
Sets the game's state to running.


processGame

public void processGame()
The main game loop for Craps. First, check to see if the player has funds remaining. If they do not, inform them and stop the game running. Next, print the player's current funds to screen and input their desired bet. Place the bet with the Player and input the type of bet requested. Next, roll the dice and calculate the winnings based on the result and the type of bet requested by the player. If the player does not have funds to cover the bet, print a message to screen.