summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model/Hand.java
diff options
context:
space:
mode:
authorBennet Gerlach <bennet_gerlach@web.de>2011-05-31 03:45:32 +0200
committerBennet Gerlach <bennet_gerlach@web.de>2011-05-31 03:45:32 +0200
commitd276b03c395e7c0e44740174168c0d98a8eaa06c (patch)
tree95642c255b484354769b7cb2ed4f9a65beb5a14e /src/jrummikub/model/Hand.java
parent278edc37a9861078d5ea1527695ef12766c0fb87 (diff)
downloadJRummikub-d276b03c395e7c0e44740174168c0d98a8eaa06c.tar
JRummikub-d276b03c395e7c0e44740174168c0d98a8eaa06c.zip
AIUtil now needs game settings, both hand and player do not anymore
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@342 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model/Hand.java')
-rw-r--r--src/jrummikub/model/Hand.java23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/jrummikub/model/Hand.java b/src/jrummikub/model/Hand.java
index 344855d..b6d9eb4 100644
--- a/src/jrummikub/model/Hand.java
+++ b/src/jrummikub/model/Hand.java
@@ -18,18 +18,6 @@ public class Hand extends StoneTray<Stone> implements IHand {
*/
public final static int WIDTH = 14;
- private GameSettings settings;
-
- /**
- * Create a new empty hand with given game settings
- *
- * @param settings
- * the game settings
- */
- public Hand(GameSettings settings) {
- this.settings = settings;
- }
-
@Override
public int getFreeRowSpace(int row) {
int count = 0;
@@ -74,7 +62,8 @@ public class Hand extends StoneTray<Stone> implements IHand {
}
}
- public int getStonePoints() {
+ @Override
+ public int getStonePoints(GameSettings settings) {
int points = 0;
for (Pair<Stone, Position> entry : this) {
@@ -89,7 +78,9 @@ public class Hand extends StoneTray<Stone> implements IHand {
}
@Override
- public boolean isInitialMeldPossible() {
+ public boolean isInitialMeldPossible(GameSettings settings) {
+ AIUtil aiUtil = new AIUtil(settings);
+
List<Stone> stones = new ArrayList<Stone>();
for (Iterator<Pair<Stone, Position>> iter = this.iterator(); iter.hasNext();) {
@@ -99,11 +90,9 @@ public class Hand extends StoneTray<Stone> implements IHand {
Pair<TreeMap<Pair<Integer, StoneColor>, Integer>, Integer> stoneCounts = AIUtil
.countStones(stones);
- Pair<List<StoneSet>, Integer> result = AIUtil.findSetsWithTotalPoints(
+ Pair<List<StoneSet>, Integer> result = aiUtil.findSetsWithTotalPoints(
settings.getInitialMeldThreshold(), stoneCounts.getFirst(),
stoneCounts.getSecond());
-
- System.out.println(result);
return (result.getSecond() >= settings.getInitialMeldThreshold());
}