Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/Referee.java
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ protected void populateMessages(Properties p) {
p.put("SkillDoof", "$%d %d %d %d");
}

// @Override
@Override
protected boolean isGameOver() {
if (players.stream().anyMatch(p -> p.score >= WIN_SCORE)) {
// We got a winner !
Expand Down Expand Up @@ -1798,7 +1798,7 @@ public AbstractReferee(InputStream is, PrintStream out, PrintStream err) throws
@SuppressWarnings("resource")
public void start() throws IOException {
try {
handleInitInputForReferee(2, new String[0]);
handleInitInputForReferee(3, new String[0]);
} catch (InvalidFormatException e) {
return;
}
Expand All @@ -1814,14 +1814,18 @@ public void start() throws IOException {
players[1] = new PlayerStatus(1);
players[2] = new PlayerStatus(2);
playerStatus = players[0];
currentPlayer = nextPlayer = 1;
currentPlayer = nextPlayer = 2;
round = -1;
newRound = true;

while (true) {
lastPlayer = playerStatus;
playerStatus = nextPlayer();

if (this.isGameOver()) {
throw new GameOverException("maxPointsReached");
}

if (this.round >= getMaxRoundCount(this.playerCount)) {
throw new GameOverException("maxRoundsCountReached");
}
Expand Down Expand Up @@ -2126,6 +2130,8 @@ protected boolean isTurnBasedGame() {

protected abstract void handleInitInputForReferee(int playerCount, String[] init) throws InvalidFormatException;

protected abstract boolean isGameOver();

protected abstract String[] getInitDataForView();

protected abstract String[] getFrameDataForView(int round, int frame, boolean keyFrame);
Expand Down