summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model
diff options
context:
space:
mode:
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;
+ }
+}