diff options
Diffstat (limited to 'src/jrummikub/control/turn/BaseAIControl.java')
-rw-r--r-- | src/jrummikub/control/turn/BaseAIControl.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/jrummikub/control/turn/BaseAIControl.java b/src/jrummikub/control/turn/BaseAIControl.java index 3c48341..cd68c37 100644 --- a/src/jrummikub/control/turn/BaseAIControl.java +++ b/src/jrummikub/control/turn/BaseAIControl.java @@ -77,14 +77,14 @@ public class BaseAIControl extends AbstractTurnControl { } private Stone findMatchingStone(Stone target) { - for (Pair<Stone, Position> entry : hand) { + for (Pair<Stone, Position> entry : player.getHand()) { Stone stone = entry.getFirst(); if (stone.getValue() == target.getValue() && stone.getColor() == target.getColor()) { return stone; } } - for (Pair<Stone, Position> entry : hand) { + for (Pair<Stone, Position> entry : player.getHand()) { Stone stone = entry.getFirst(); if (stone.isJoker()) { return stone; @@ -95,14 +95,14 @@ public class BaseAIControl extends AbstractTurnControl { private Stone pickUpMatchingStone(Stone target) { Stone match = findMatchingStone(target); - hand.pickUp(match); + player.getHand().pickUp(match); return match; } private void turn() { List<Stone> stones = new ArrayList<Stone>(); - for (Pair<Stone, Position> entry : hand) { + for (Pair<Stone, Position> entry : player.getHand()) { stones.add(entry.getFirst()); } @@ -147,8 +147,8 @@ public class BaseAIControl extends AbstractTurnControl { private void emitEndOfTurn() { long timeElapsed = System.currentTimeMillis() - startTime; - long timeNeeded = Math.min((long) (1000 + Math.random() * hand.getSize() - * 100), 50000); + long timeNeeded = Math.min((long) (1000 + Math.random() + * player.getHand().getSize() * 100), 50000); long waitTime = timeNeeded - timeElapsed; if (waitTime > 0) { |