1 | package io.github.mathieusoysal.yatzy_mod; | |
2 | ||
3 | import io.github.mathieusoysal.Dices; | |
4 | ||
5 | /** | |
6 | * The {@code YMYatzy} class represents the "Yatzy" category scoring mod in the | |
7 | * Yatzy game. | |
8 | * <p> | |
9 | * In this category, players score 50 points if all dice have the same number. | |
10 | * </p> | |
11 | * | |
12 | * @author MathieuSoysal | |
13 | * @see YatzyModInterface | |
14 | */ | |
15 | class YMYatzy implements YatzyModInterface { | |
16 | ||
17 | /** | |
18 | * Calculates the score for the "Yatzy" category. | |
19 | * | |
20 | * @param dices The set of dice to calculate the score for. | |
21 | * @return The calculated score, which is 50 if all dice have the same number, | |
22 | * or zero if not. | |
23 | * | |
24 | * @see Dices#getDicesIntStream() | |
25 | */ | |
26 | @Override | |
27 | public int calculateScore(Dices dices) { | |
28 |
1
1. calculateScore : negated conditional → KILLED |
return dices.getDicesIntStream().distinct().count() == 1 ? 50 : 0; |
29 | } | |
30 | } | |
Mutations | ||
28 |
1.1 |