Tested and implemented scoring

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@272 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Jannis Harder 2011-05-25 15:51:34 +02:00
parent e3b5a0790d
commit 157bd4f606
8 changed files with 283 additions and 29 deletions

View file

@ -60,6 +60,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

View file

@ -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() {

View file

@ -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;
}
}