SpielKniffel Klasse fassade ändern
parent
b424564985
commit
5431c57491
|
@ -13,7 +13,7 @@ public class KniffelSpiel {
|
|||
|
||||
private Spiel spiel;
|
||||
private Scanner scanner;
|
||||
private Würfel würfel;
|
||||
//private Würfel würfel;
|
||||
private int numPlayers;
|
||||
|
||||
public KniffelSpiel() {
|
||||
|
@ -32,6 +32,8 @@ public class KniffelSpiel {
|
|||
} while (numSides != 6 && numSides != 8);
|
||||
scanner.nextLine();
|
||||
this.spiel = new Spiel(numPlayers, numSides);
|
||||
|
||||
//this.würfel = new Würfel(numSides);
|
||||
|
||||
}
|
||||
|
||||
|
@ -54,12 +56,15 @@ public class KniffelSpiel {
|
|||
for (Spieler player : spiel.getSpieler()) {
|
||||
System.out.println("Player " + player.getNumber() + " of " + numPlayers + "'s turn:");
|
||||
rollAndRerollDice();
|
||||
|
||||
displayCategories();
|
||||
askUserForCategory();
|
||||
displayScore();
|
||||
//displayScore();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*spiel.nextPlayer();
|
||||
|
||||
int currentPlayerIndex = spiel.getCurrentPlayerIndex();
|
||||
|
@ -78,7 +83,7 @@ public class KniffelSpiel {
|
|||
break;
|
||||
}
|
||||
}
|
||||
displayFinalScore();
|
||||
//displayScore();
|
||||
displayFinalScoreGewinner();
|
||||
}
|
||||
|
||||
|
@ -127,25 +132,27 @@ public class KniffelSpiel {
|
|||
|
||||
System.out.print("Enter category (1-17): ");
|
||||
int categoryIndex = scanner.nextInt();
|
||||
scanner.nextLine(); // consume newline left-over
|
||||
scanner.nextLine();
|
||||
//spiel.setKategorieScore(categoryIndex, calculateCategoryScore(categoryIndex));
|
||||
|
||||
int score = calculateCategoryScore(categoryIndex, würfel);
|
||||
int score = calculateCategoryScore(categoryIndex);
|
||||
spiel.setKategorieScore(categoryIndex, score);
|
||||
|
||||
int playerIndex = spiel.getCurrentPlayerIndex();
|
||||
spiel.getSpieler().get(playerIndex).setScoreForCategory(categoryIndex, score);
|
||||
|
||||
displayScore(categoryIndex);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int calculateCategoryScore(int categoryIndex, Würfel würfel) {
|
||||
return spiel.calculateKategorieScore(categoryIndex, würfel);
|
||||
private int calculateCategoryScore(int categoryIndex) {
|
||||
return spiel.calculateKategorieScore(categoryIndex);
|
||||
}
|
||||
|
||||
private void displayScore() {
|
||||
System.out.println("Score: " + spiel.calculateTotalScore(würfel));
|
||||
private void displayScore(int categoryIndex) {
|
||||
System.out.println("Score: " + spiel.calculateTotalScore(categoryIndex));
|
||||
}
|
||||
|
||||
private boolean isGameFinished() {
|
||||
|
@ -159,13 +166,7 @@ public class KniffelSpiel {
|
|||
}
|
||||
|
||||
|
||||
private void displayFinalScore() {
|
||||
System.out.println("Final score: " + spiel.calculateTotalScore(würfel));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int[] getDiceValues() {
|
||||
return spiel.getWürfelValues();
|
||||
}
|
||||
|
@ -203,7 +204,6 @@ public class KniffelSpiel {
|
|||
public void deleteHighscores() {
|
||||
|
||||
spiel.getHighscores().clear();
|
||||
System.out.println("Highscores have been deleted.");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue