1 | package io.github.mathieusoysal.yatzy_mod; | |
2 | ||
3 | import io.github.mathieusoysal.Dices; | |
4 | ||
5 | /** | |
6 | * The {@code YMFourOfAKind} class represents the "Four of a Kind" category in | |
7 | * the Yatzy game. | |
8 | * | |
9 | * <p> | |
10 | * In the "Four of a Kind" category, the player scores the sum of four dice with | |
11 | * the same number. | |
12 | * </p> | |
13 | * | |
14 | * @author MathieuSoysal | |
15 | * @see YatzyModInterface | |
16 | * @see YatzyModUtils | |
17 | */ | |
18 | class YMFourOfAKind implements YatzyModInterface { | |
19 | ||
20 | /** | |
21 | * Calculates the score for the "Four of a Kind" category based on the sum of | |
22 | * four dice with the same number. | |
23 | * If there are no four dice with the same number, the score is zero. | |
24 | * | |
25 | * @param dices The set of dice to calculate the score for. | |
26 | * @return The calculated score, which is the sum of four dice with the same | |
27 | * number or zero if not possible. | |
28 | * @see YatzyModUtils#filterByFrequency(int, Dices) | |
29 | */ | |
30 | @Override | |
31 | public int calculateScore(Dices dices) { | |
32 |
1
1. calculateScore : replaced int return with 0 for io/github/mathieusoysal/yatzy_mod/YMFourOfAKind::calculateScore → KILLED |
return YatzyModUtils.filterByFrequency(4, dices) |
33 | .findAny() | |
34 |
1
1. calculateScore : Replaced integer multiplication with division → KILLED |
.orElse(0) * 4; |
35 | } | |
36 | } | |
Mutations | ||
32 |
1.1 |
|
34 |
1.1 |