Class HoldAt20PigPlayer java.lang.Object HoldAt20PigPlayer All Implemented Interfaces:PigPlayerpublic class HoldAt20PigPlayerextends java.lang.Objectimplements 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 PigPlayerParameters:myScore - an int value - the player's scoreotherScore - an int value - the opponent's scoreturnTotal - an int value - the player's current turn totalReturns:a boolean value - whether or not the player will continue to roll
Class HoldAt20PigPlayer
java.lang.Object HoldAt20PigPlayer All Implemented Interfaces:PigPlayerpublic class HoldAt20PigPlayerextends java.lang.Objectimplements 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 PigPlayerParameters:myScore - an int value - the player's scoreotherScore - an int value - the opponent's scoreturnTotal - an int value - the player's current turn totalReturns:a boolean value - whether or not the player will continue to roll


Trending now
This is a popular solution!
Step by step
Solved in 2 steps









