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