Enum Class YatzyMod

java.lang.Object
java.lang.Enum<YatzyMod>
io.github.mathieusoysal.yatzy_mod.YatzyMod
All Implemented Interfaces:
Serializable, Comparable<YatzyMod>, Constable

public enum YatzyMod extends Enum<YatzyMod>
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 Constants
    Enum Constant
    Description
    CHANCE 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 Type
    Method
    Description
    int
    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[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • CHANCE

      public static final YatzyMod CHANCE
      CHANCE Is the sum of all dice, no matter what they read.
      See Also:
      • YMChance
    • YATZY

      public static final YatzyMod YATZY
      YATZY If all dice have the same number, the player scores 50 points.
      See Also:
      • YMYatzy
    • ONES

      public static final YatzyMod ONES
      ONES The player scores the sum of the dice that reads one respectively.
      See Also:
      • YMOnes
    • TWOS

      public static final YatzyMod TWOS
      TWOS The player scores the sum of the dice that reads two respectively.
      See Also:
      • YMTwos
    • THREES

      public static final YatzyMod THREES
      THREES The player scores the sum of the dice that reads three respectively.
      See Also:
      • YMThrees
    • FOURS

      public static final YatzyMod FOURS
      FOURS The player scores the sum of the dice that reads four respectively.
      See Also:
      • YMFours
    • FIVES

      public static final YatzyMod FIVES
      FIVES The player scores the sum of the dice that reads five respectively.
      See Also:
      • YMFives
    • SIXES

      public static final YatzyMod SIXES
      SIXES The player scores the sum of the dice that reads six respectively.
      See Also:
      • YMSixes
    • PAIR

      public static final YatzyMod PAIR
      PAIR The player scores the sum of the two highest matching dice.
      See Also:
      • YMPair
    • TWO_PAIRS

      public static final YatzyMod 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

      public static final YatzyMod 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

      public static final YatzyMod 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

      public static final YatzyMod 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

      public static final YatzyMod 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

      public static final YatzyMod 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

      public static YatzyMod[] 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

      public static YatzyMod valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • calculateScore

      public int calculateScore(Dices dices)
      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: