summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-25 15:51:34 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-25 15:51:34 +0200
commit157bd4f60635dc27d2c9baebea5589455b05f17b (patch)
treeb85dda7fea57ca297c79f26c3764954683465eec /src/jrummikub/model
parente3b5a0790dbb5c9ffeb5c23db81528faef3a1a05 (diff)
downloadJRummikub-157bd4f60635dc27d2c9baebea5589455b05f17b.tar
JRummikub-157bd4f60635dc27d2c9baebea5589455b05f17b.zip
Tested and implemented scoring
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@272 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model')
-rw-r--r--src/jrummikub/model/IRoundState.java9
-rw-r--r--src/jrummikub/model/RoundState.java9
-rw-r--r--src/jrummikub/model/Score.java42
3 files changed, 60 insertions, 0 deletions
diff --git a/src/jrummikub/model/IRoundState.java b/src/jrummikub/model/IRoundState.java
index 4dbcd9a..faed6cf 100644
--- a/src/jrummikub/model/IRoundState.java
+++ b/src/jrummikub/model/IRoundState.java
@@ -61,6 +61,15 @@ public interface IRoundState {
public IPlayer getNthNextPlayer(int i);
/**
+ * Returns the nth player
+ *
+ * @param i
+ * player number
+ * @return nth player
+ */
+ public IPlayer getNthPlayer(int i);
+
+ /**
* Sets the player that will make the last turn before the round ends when
* the heap is empty
*
diff --git a/src/jrummikub/model/RoundState.java b/src/jrummikub/model/RoundState.java
index c32c3c0..eb87247 100644
--- a/src/jrummikub/model/RoundState.java
+++ b/src/jrummikub/model/RoundState.java
@@ -70,6 +70,15 @@ public class RoundState implements IRoundState {
}
return players.get(j);
}
+
+ @Override
+ public IPlayer getNthPlayer(int i) {
+ int j = i % players.size();
+ if (j < 0) {
+ j += players.size();
+ }
+ return players.get(j);
+ }
@Override
public IPlayer getActivePlayer() {
diff --git a/src/jrummikub/model/Score.java b/src/jrummikub/model/Score.java
new file mode 100644
index 0000000..adc78a7
--- /dev/null
+++ b/src/jrummikub/model/Score.java
@@ -0,0 +1,42 @@
+package jrummikub.model;
+
+import java.util.List;
+
+/**
+ * Score of a single round
+ */
+public class Score {
+ List<Boolean> winners;
+ List<Integer> points;
+
+ /**
+ * Create a new round score
+ *
+ * @param winners
+ * set for each player among the winners
+ * @param points
+ * points of each player
+ */
+ public Score(List<Boolean> winners, List<Integer> points) {
+ this.winners = winners;
+ this.points = points;
+ }
+
+ /**
+ * Get the winner list
+ *
+ * @return set for each player among the winners
+ */
+ public List<Boolean> getWinners() {
+ return winners;
+ }
+
+ /**
+ * Get the point list
+ *
+ * @return points of each player
+ */
+ public List<Integer> getPoints() {
+ return points;
+ }
+}