import java.util.Collections; import java.util.ArrayList; import java.util.List; /** * A utility class that encodes a subset of the rules for * the game Yahtzee. * *
A description of the scoring categories can be
* found on the
* Yahtzee Wikipedia web page.
*
* @author EECS1011E_W15
*
*/
public class Yahtzee {
private Yahtzee() {
// private and empty by design
throw new AssertionError();
}
/**
* The number of six-sided dice used in a standard game of Yahtzee.
*/
public static final int NUMBER_OF_DICE = 5;
/**
* Returns true
if the list contains a three of a kind.
*
*
A three of a kind is defined as at least three dice having
* the same value.
*
* @param dice list of dice
* @pre. dice.size() == Yahtzee.NUMBER_OF_DICE
* @return true
if the list contains a three of a kind
*/
public static boolean isThreeOfAKind(List