Commit 7cb57cf9 authored by LI Qi's avatar LI Qi
Browse files

add 'show score' fonctionnality

parent ae998606
......@@ -26,13 +26,44 @@ public class Game {
}
}
public Player startSet() {
Set newSet = new Set(players);
while(!newSet.isOver()) {
Player next = newSet.getNextPlayer();
System.out.format("%n%s, please enter the point: ", next.getName());
newSet.enterPoint(inputReader.nextInt());
System.out.format("%s's score table:%n%s%n", next.getName(), newSet.getScoreTable(next));
int point = -1;
while (point < 0 || point > 10) {
System.out.format("%n%s, please enter the point: ", next.getName());
if (!inputReader.hasNextInt()) {
String command = inputReader.next();
inputReader.nextLine();
if (command.equals("score")) {
for (int i = 0; i < players.size(); ++i) {
Player player = players.get(i);
System.out.format("%s's score table:%n%s%n", player.getName(), newSet.getScoreTable(player));
}
} else if (command.equals("quit")) {
}
} else {
point = inputReader.nextInt();
inputReader.nextLine();
try {
String info = newSet.enterPoint(point);
if (info != null) System.out.println(info);
System.out.format("%s's score table:%n%s%n", next.getName(), newSet.getScoreTable(next));
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
}
return newSet.getWinner();
}
......
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