This commit is contained in:
Daniel Langbein 2024-12-14 19:48:17 +00:00
parent 5926655a54
commit 0cd27b8d31
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
3 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ public class Game {
return;
default:
int i = Integer.parseInt(line);
player.toggleMark(i);
player.toggleMarked(i);
System.out.println(player);
break;
}

View File

@ -68,7 +68,7 @@ public class Player implements DiceInteraction{
.forEach(Dice::roll);
}
public void toggleMark(int diceIdx) throws SelectionException {
public void toggleMarked(int diceIdx) throws SelectionException {
if (diceIdx < 0 || diceIdx >= dices.length) {
throw new SelectionException("Invalid dice index: " + diceIdx);
}
@ -159,7 +159,7 @@ public class Player implements DiceInteraction{
@Override
public int changeDiceState(int diceIdx) throws SelectionException {
toggleMark(diceIdx);
toggleMarked(diceIdx);
return roundScore + selectionScore();
}
}

View File

@ -37,7 +37,7 @@ class PlayerTest {
int diceIdx = 1;
player.toggleMark(diceIdx);
player.toggleMarked(diceIdx);
expected = "0 + 50: 4 (5) 6 6 2 6 ";
assertEquals(expected, player.toStringHelper());
@ -45,7 +45,7 @@ class PlayerTest {
expected = "0 + 50: 1 [5] 2 5 4 2 ";
assertEquals(expected, player.toStringHelper());
assertThrows(IllegalArgumentException.class, () -> player.toggleMark(diceIdx));
assertThrows(IllegalArgumentException.class, () -> player.toggleMarked(diceIdx));
}
@Test