Enum Class YatzyMod
- All Implemented Interfaces:
Serializable
,Comparable<YatzyMod>
,Constable
The
YatzyMod
enum represents different scoring categories in the
Yatzy game. Each category has a specific scoring rule associated with it.- Author:
- MathieuSoysal
- See Also:
-
Dices
YatzyModInterface
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCHANCE Is the sum of all dice, no matter what they read.FIVES The player scores the sum of the dice that reads five respectively.FOUR_OF_A_KIND The player scores the sum of four dice with the same number.FOURS The player scores the sum of the dice that reads four respectively.FULL_HOUSE The player scores the sum of all dice if they form a full house (two of a kind and three of a kind).LARGE_STRAIGHT The player scores 20 if the dice form a large straight (2, 3, 4, 5, 6).ONES The player scores the sum of the dice that reads one respectively.PAIR The player scores the sum of the two highest matching dice.SIXES The player scores the sum of the dice that reads six respectively.SMALL_STRAIGHT The player scores 15 if the dice form a small straight (1, 2, 3, 4, 5).THREE_OF_A_KIND The player scores the sum of three dice with the same number.THREES The player scores the sum of the dice that reads three respectively.TWO_PAIRS The player scores the sum of the two pairs of dice with the same number.TWOS The player scores the sum of the dice that reads two respectively.YATZY If all dice have the same number, the player scores 50 points. -
Method Summary
Modifier and TypeMethodDescriptionint
calculateScore
(Dices dices) Calculate the score for a given set of dice based on the category represented by this enum value.static YatzyMod
Returns the enum constant of this class with the specified name.static YatzyMod[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CHANCE
CHANCE Is the sum of all dice, no matter what they read.- See Also:
-
YMChance
-
YATZY
YATZY If all dice have the same number, the player scores 50 points.- See Also:
-
YMYatzy
-
ONES
ONES The player scores the sum of the dice that reads one respectively.- See Also:
-
YMOnes
-
TWOS
TWOS The player scores the sum of the dice that reads two respectively.- See Also:
-
YMTwos
-
THREES
THREES The player scores the sum of the dice that reads three respectively.- See Also:
-
YMThrees
-
FOURS
FOURS The player scores the sum of the dice that reads four respectively.- See Also:
-
YMFours
-
FIVES
FIVES The player scores the sum of the dice that reads five respectively.- See Also:
-
YMFives
-
SIXES
SIXES The player scores the sum of the dice that reads six respectively.- See Also:
-
YMSixes
-
PAIR
PAIR The player scores the sum of the two highest matching dice.- See Also:
-
YMPair
-
TWO_PAIRS
TWO_PAIRS The player scores the sum of the two pairs of dice with the same number.- See Also:
-
YMTwoPairs
-
THREE_OF_A_KIND
THREE_OF_A_KIND The player scores the sum of three dice with the same number.- See Also:
-
YMThreeOfAKind
-
FOUR_OF_A_KIND
FOUR_OF_A_KIND The player scores the sum of four dice with the same number.- See Also:
-
YMFourOfAKind
-
SMALL_STRAIGHT
SMALL_STRAIGHT The player scores 15 if the dice form a small straight (1, 2, 3, 4, 5).- See Also:
-
YMSmallStraight
-
LARGE_STRAIGHT
LARGE_STRAIGHT The player scores 20 if the dice form a large straight (2, 3, 4, 5, 6).- See Also:
-
YMLargeStraight
-
FULL_HOUSE
FULL_HOUSE The player scores the sum of all dice if they form a full house (two of a kind and three of a kind).- See Also:
-
YMFullHouse
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
calculateScore
Calculate the score for a given set of dice based on the category represented by this enum value.- Parameters:
dices
- The set of dice.- Returns:
- The calculated score for the category.
- Throws:
NullDicesException
- If the given set of dice is null.- See Also:
-