Commit edc6f3df authored by Qi LI's avatar Qi LI
Browse files

get score table of a player and get winner

parent 062e0778
......@@ -32,6 +32,25 @@ public class Set {
return currentPlayerIndex == -1;
}
public String getScoreTable(Player player) {
return tables.get(player).readTable();
}
public Player getWinner() {
Player winner = null;
int maxScore = 0;
for (int i = 0; i < players.size(); ++i) {
Player player = players.get(i);
ScoreTable table = tables.get(player);
int score = table.getCurrentScore();
if (score > maxScore) {
maxScore = score;
winner = player;
}
}
return winner;
}
private void updatePlayerIndex() {
if (frameCount < 10) {
Frame currentFrame = tables.get(players.get(currentPlayerIndex)).getCurrentFrame();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment