autoLockIn fix

main
s.eser 2024-04-30 13:08:57 +02:00
parent e2d9e58c35
commit 936474c659
6 changed files with 9 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -41,7 +41,7 @@ public class Hand {
}
}
public void autoLockInDices() {
public boolean autoLockInDices() {
int mem = this.dices.size();
@ -50,10 +50,10 @@ public class Hand {
for (int i = 0; i < mem; i++) {
lockInDice(dices.get(0).getDiceNumber());
}
System.out.println("No rolls left, auto locking in all left dices...");
return true;
}
return false;
}
public int getLockedInDiceAmount() {

View File

@ -76,9 +76,9 @@ public class YahtzeeGame {
}
public void autoLockInDices(int player) {
public boolean autoLockInDices(int player) {
players.get(player).hand.autoLockInDices();
return players.get(player).hand.autoLockInDices();
}

View File

@ -84,7 +84,9 @@ public class TUI {
System.out.println("Free dices: " + game.getFreeDiceNumbers(i));
System.out.println("Locked in dices: " + game.getLockedInDiceNumbers(i));
game.autoLockInDices(i);
if(game.autoLockInDices(i)){
System.out.println("\nNo rolls left auto locking dices....\n");
}
if (!game.noMoreRolls(i)) {
System.out.println(
"Type in which free dices you want to keep \n(seperated by space, type 'none' if you dont want to keep any): ");