From a0bab4f87a323b881f40a45741e96eb2d2dc15c4 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Wed, 17 May 2017 08:46:31 +0200 Subject: Add tests for board score computation --- .../luxons/sevenwonders/game/scoring/PlayerScore.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'backend/src/main/java/org/luxons') 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 { +public class PlayerScore { private final int boardGold; + private final Map 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 getPointsPerCategory() { + return scoresByCategory; } public int getTotalPoints() { -- cgit