diff options
Diffstat (limited to 'src/jrummikub/model')
-rw-r--r-- | src/jrummikub/model/GameSettings.java | 39 | ||||
-rw-r--r-- | src/jrummikub/model/StoneHeap.java | 2 | ||||
-rw-r--r-- | src/jrummikub/model/StoneSet.java | 12 |
3 files changed, 27 insertions, 26 deletions
diff --git a/src/jrummikub/model/GameSettings.java b/src/jrummikub/model/GameSettings.java index d571a93..f3cf69a 100644 --- a/src/jrummikub/model/GameSettings.java +++ b/src/jrummikub/model/GameSettings.java @@ -1,11 +1,12 @@ package jrummikub.model; +import static jrummikub.model.StoneColor.*; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; -import static jrummikub.model.StoneColor.*; /** * The overall game settings @@ -16,7 +17,7 @@ public class GameSettings { private int initialMeldThreshold; private int jokerPoints; private int jokerNumber; - private int highestCard; + private int highestValue; private int stoneSetNumber; private int numberOfStonesDealt; private boolean noLimits; @@ -29,12 +30,12 @@ public class GameSettings { initialMeldThreshold = 30; jokerPoints = 50; jokerNumber = 2; - highestCard = 13; + highestValue = 13; stoneSetNumber = 2; numberOfStonesDealt = 14; noLimits = false; - stoneColors = new HashSet<StoneColor>(Arrays.asList(BLACK, BLUE, - ORANGE, RED)); + stoneColors = new HashSet<StoneColor>(Arrays.asList(BLACK, BLUE, ORANGE, + RED)); } /** @@ -50,7 +51,7 @@ public class GameSettings { * Sets the initial meld threshold * * @param value - * the value to set + * the value to set */ public void setInitialMeldThreshold(int value) { initialMeldThreshold = value; @@ -69,7 +70,7 @@ public class GameSettings { * Sets the points counted for a joker * * @param value - * the value to set + * the value to set */ public void setJokerPoints(int value) { jokerPoints = value; @@ -103,22 +104,22 @@ public class GameSettings { } /** - * Return the highest card value in use + * Return the highest stone value in use * - * @return highest card value + * @return highest stone value */ - public int getHighestCard() { - return highestCard; + public int getHighestValue() { + return highestValue; } /** - * Set the highest card value in use + * Set the highest stone value in use * - * @param highestCard - * highest card value + * @param highestValue + * highest stone value */ - public void setHighestCard(int highestCard) { - this.highestCard = highestCard; + public void setHighestValue(int highestValue) { + this.highestValue = highestValue; } /** @@ -134,7 +135,7 @@ public class GameSettings { * Set the number of sets of stones in use * * @param stoneSets - * sets of stones in use + * sets of stones in use */ public void setStoneSetNumber(int stoneSets) { this.stoneSetNumber = stoneSets; @@ -153,7 +154,7 @@ public class GameSettings { * Set whether "No-Limits" rules are used * * @param noLimits - * use no limit rules + * use no limit rules */ public void setNoLimits(boolean noLimits) { this.noLimits = noLimits; @@ -172,7 +173,7 @@ public class GameSettings { * Set stone colors used * * @param stoneColors - * used stone colors + * used stone colors */ public void setStoneColors(Set<StoneColor> stoneColors) { this.stoneColors = stoneColors; diff --git a/src/jrummikub/model/StoneHeap.java b/src/jrummikub/model/StoneHeap.java index 27c8d01..b3c5fbe 100644 --- a/src/jrummikub/model/StoneHeap.java +++ b/src/jrummikub/model/StoneHeap.java @@ -23,7 +23,7 @@ public class StoneHeap { * */ public StoneHeap(GameSettings gameSettings) { heap = new ArrayList<Stone>(); - for (int i = 1; i <= gameSettings.getHighestCard(); i++) { + for (int i = 1; i <= gameSettings.getHighestValue(); i++) { for (int j = 0; j < gameSettings.getStoneSetNumber(); j++) { for (StoneColor c : gameSettings.getStoneColors()) { heap.add(new Stone(i, c)); diff --git a/src/jrummikub/model/StoneSet.java b/src/jrummikub/model/StoneSet.java index efe7a2e..3324565 100644 --- a/src/jrummikub/model/StoneSet.java +++ b/src/jrummikub/model/StoneSet.java @@ -75,19 +75,19 @@ public class StoneSet implements Iterable<Stone>, Sizeable { } if (nonJoker == -1) { - if (stones.size() > settings.getHighestCard()) { + if (stones.size() > settings.getHighestValue()) { return new Pair<Type, Integer>(INVALID, 0); } else if (stones.size() > settings.getStoneColors().size()) { return new Pair<Type, Integer>( RUN, - (settings.getHighestCard() * (settings.getHighestCard() + 1)) + (settings.getHighestValue() * (settings.getHighestValue() + 1)) / 2 - - (stones.size() - settings.getHighestCard()) - * (stones.size() - settings.getHighestCard() - 1) + - (stones.size() - settings.getHighestValue()) + * (stones.size() - settings.getHighestValue() - 1) / 2); } else { return new Pair<Type, Integer>(GROUP, stones.size() - * settings.getHighestCard()); + * settings.getHighestValue()); } } @@ -115,7 +115,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable { int startValue = stones.get(referencePosition).getValue() - referencePosition; int endValue = startValue + stones.size() - 1; - if (startValue < 1 || endValue > settings.getHighestCard()) { + if (startValue < 1 || endValue > settings.getHighestValue()) { return 0; } for (int i = 0; i < stones.size(); i++) { |