diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-24 01:51:56 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-24 01:51:56 +0200 |
commit | 4a98975b0da4baa4158140ba85f39ffa669ba7a8 (patch) | |
tree | 6fc390ed5b983ac8f7a70fc76967d68a3145e8f4 /src/jrummikub/model/Hand.java | |
parent | 92d110995488380778bd378f4297032a325dc385 (diff) | |
download | JRummikub-4a98975b0da4baa4158140ba85f39ffa669ba7a8.tar JRummikub-4a98975b0da4baa4158140ba85f39ffa669ba7a8.zip |
Calculate points on hand
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@264 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model/Hand.java')
-rw-r--r-- | src/jrummikub/model/Hand.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/jrummikub/model/Hand.java b/src/jrummikub/model/Hand.java index ab5eb19..35ea49f 100644 --- a/src/jrummikub/model/Hand.java +++ b/src/jrummikub/model/Hand.java @@ -10,6 +10,12 @@ public class Hand extends StoneTray<Stone> implements IHand { * The width of the hand */ public final static int WIDTH = 14; + + private GameSettings settings; + + public Hand(GameSettings settings) { + this.settings = settings; + } @Override public int getFreeRowSpace(int row) { @@ -54,4 +60,18 @@ public class Hand extends StoneTray<Stone> implements IHand { } } } + + public int getStonePoints() { + int points = 0; + + for (Pair<Stone, Position> entry : this) { + if (entry.getFirst().isJoker()) { + points += settings.getJokerPoints(); + } else { + points += entry.getFirst().getValue(); + } + } + + return points; + } } |