diff --git a/KniffelSpiel/src/domain/Spieler.java b/KniffelSpiel/src/domain/Spieler.java new file mode 100644 index 0000000..df2ab35 --- /dev/null +++ b/KniffelSpiel/src/domain/Spieler.java @@ -0,0 +1,71 @@ +package domain; + + +public class Spieler { + + private int number; + private String Name; + private int[] scores; + private int score; + + public Spieler(int number) { + this.number = number; + this.Name = ""; + this.scores = new int[Kategorie.values().length]; + this.score = 0; + } + + public Spieler() { + this(0); + } + + public int getNumber() { + return number + 1; + } + + public void setNumber(int number) { + this.number = number; + } + + + public String getName() { + return Name; + } + + public void setName(String Name) { + this.Name = Name; + } + + public int getScore(int categoryIndex) { + return scores[categoryIndex]; + } + + public void setScore(int categoryIndex, int score) { + scores[categoryIndex] = score; + } + + public void setScoreForCategory(int categoryIndex, int score) { + this.score = score; + // Дополнительная логика, если необходимо + } + + + + public int getTotalScore() { + int totalScore = 0; + for (int score : scores) { + totalScore += score; + } + return totalScore; + } + + + public void resetScore() { + for (int i = 0; i < scores.length; i++) { + scores[i] = 0; + } + } + + + +}