// CrapsPlayer.java // Has methods for the come-out roll and all the later rolls. // Assumes that the player is a right bettor. public class CrapsPlayer { private Dice theDice; // a pair of dice private int thePoint; // the point from the come-out roll // Constructor to start a game of craps. Creates the dice, performs // the come-out roll to set the point, and announces the result of // the come-out roll. public CrapsPlayer() { theDice = new Dice(); thePoint = theDice.roll(); System.out.println("The come-out roll is " + thePoint + "."); } // Returns true if the point is an automatic loser. public boolean isAutomaticLoser() { return thePoint == 2 || thePoint == 3 || thePoint == 12; } // Returns true if the point is an automatic winner. public boolean isAutomaticWinner() { return thePoint == 7 || thePoint == 11; } // Performs a roll after the come-out roll. Just returns the value rolled. public int roll() { return theDice.roll(); } // Returns true if the supplied roll equals the point. public boolean isWinner(int roll) { return roll == thePoint; } }