Class HoldAt20PigPlayer

java.lang.Object
  extended by HoldAt20PigPlayer
All Implemented Interfaces:
PigPlayer

public class HoldAt20PigPlayer
extends java.lang.Object
implements PigPlayer

HoldAt20PigPlayer - a Pig player that rolls as long as the turn total is less than 20 and the player's score plus the turn total is less than the goal score PigGame.GOAL_SCORE.


Constructor Summary
HoldAt20PigPlayer()
           
 
Method Summary
 boolean isRolling(int myScore, int otherScore, int turnTotal)
          isRolling - return whether or not the player rolls, given the current game state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HoldAt20PigPlayer

public HoldAt20PigPlayer()
Method Detail

isRolling

public boolean isRolling(int myScore,
                         int otherScore,
                         int turnTotal)
isRolling - return whether or not the player rolls, given the current game state. The hold-at-20-or-goal player rolls as long as the turn total is less than 20 and the player's score plus the turn total is less than the goal score PigGame.GOAL_SCORE.

Specified by:
isRolling in interface PigPlayer
Parameters:
myScore - an int value - the player's score
otherScore - an int value - the opponent's score
turnTotal - an int value - the player's current turn total
Returns:
a boolean value - whether or not the player will continue to roll