From bc835d499f2fe3c8b9c5b6bc9cfca9d9666854e9 Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Sat, 18 Jun 2011 15:01:21 +0200 Subject: Fix many comments, fix tests, fix complexity git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@462 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/RoundControl.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/jrummikub/control/RoundControl.java') diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java index f060420..fb4ab0c 100644 --- a/src/jrummikub/control/RoundControl.java +++ b/src/jrummikub/control/RoundControl.java @@ -228,10 +228,12 @@ public class RoundControl { } else { List markedStones = new ArrayList(); for (Pair set : clonedTable) { - if (!set.getFirst().isValid(roundState.getGameSettings())) { - for (Stone stone : set.getFirst()) { - markedStones.add(stone); - } + if (set.getFirst().isValid(roundState.getGameSettings())) { + continue; + } + for (Stone stone : set.getFirst()) { + markedStones.add(stone); + } } view.setStoneCollectionHidden(true); @@ -401,8 +403,8 @@ public class RoundControl { .getGameSettings()); } - bestScore = updateBestScore(bestScore, -stonePoints, - playerHand.getSize()); + bestScore = updateBestScore(bestScore, -stonePoints, playerHand + .getSize()); points.add(-stonePoints); pointSum += stonePoints; @@ -424,8 +426,8 @@ public class RoundControl { private static Pair updateBestScore( Pair bestScore, int stonePoints, int size) { if (bestScore.getFirst() == stonePoints) { - return new Pair(stonePoints, Math.min( - bestScore.getSecond(), size)); + return new Pair(stonePoints, Math.min(bestScore + .getSecond(), size)); } else if (bestScore.getFirst() < stonePoints) { return new Pair(stonePoints, size); } -- cgit v1.2.3