diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-17 08:46:31 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-17 08:46:31 +0200 |
commit | a0bab4f87a323b881f40a45741e96eb2d2dc15c4 (patch) | |
tree | 47b54c00454aa8eda92f51474180e05354b250f2 /backend/src/main | |
parent | Add test for Requirements coverage (diff) | |
download | seven-wonders-a0bab4f87a323b881f40a45741e96eb2d2dc15c4.tar.gz seven-wonders-a0bab4f87a323b881f40a45741e96eb2d2dc15c4.tar.bz2 seven-wonders-a0bab4f87a323b881f40a45741e96eb2d2dc15c4.zip |
Add tests for board score computation
Diffstat (limited to 'backend/src/main')
-rw-r--r-- | backend/src/main/java/org/luxons/sevenwonders/game/scoring/PlayerScore.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/PlayerScore.java b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/PlayerScore.java index f67924e1..f4a0d832 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/scoring/PlayerScore.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/scoring/PlayerScore.java @@ -1,21 +1,31 @@ package org.luxons.sevenwonders.game.scoring; import java.util.HashMap; +import java.util.Map; -public class PlayerScore extends HashMap<ScoreCategory, Integer> { +public class PlayerScore { private final int boardGold; + private final Map<ScoreCategory, Integer> scoresByCategory = new HashMap<>(); + private int totalPoints = 0; public PlayerScore(int boardGold) { this.boardGold = boardGold; } - @Override public Integer put(ScoreCategory category, Integer points) { totalPoints += points; - return super.put(category, points); + return scoresByCategory.put(category, points); + } + + public int getPoints(ScoreCategory category) { + return scoresByCategory.get(category); + } + + public Map<ScoreCategory, Integer> getPointsPerCategory() { + return scoresByCategory; } public int getTotalPoints() { |