@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("<"); sb.append("ID " + id); sb.append(", game ID: " + game.getId()); sb.append(", player 1 score: " + player1Score); sb.append(", player 2 score: " + player2Score); if (winner != null) { sb.append(", winner: " + winner.getName()); sb.append(" (ID " + winner.getId() + ")"); } sb.append(">"); return sb.toString(); }
@Override public IPlayer getWinner() { return player1Score > player2Score ? game.getPlayer1() : game.getPlayer2(); }