diff options
-rw-r--r-- | src/jrummikub/model/StoneSet.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/jrummikub/model/StoneSet.java b/src/jrummikub/model/StoneSet.java index 98a808e..3723e75 100644 --- a/src/jrummikub/model/StoneSet.java +++ b/src/jrummikub/model/StoneSet.java @@ -68,7 +68,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable { } // is group else { - return isValidGroup() ? GROUP : INVALID; + return isValidGroup(stones.get(nonJoker1).getValue()) ? GROUP : INVALID; } } @@ -104,7 +104,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable { /** * Test for rule conflict within the StoneSet, assuming we have a group */ - private boolean isValidGroup() { + private boolean isValidGroup(int value) { if (stones.size() > 4) { return false; } @@ -113,6 +113,9 @@ public class StoneSet implements Iterable<Stone>, Sizeable { if (i.isJoker()) { continue; } + if (i.getValue() != value) { + return false; + } if (seenColors.contains(i.getColor())) { return false; } else { |