/** * Returns the winner of this game. * * @return the winner of this game or <code>null</code> if there is no winner. */ public Player getWinner() { Player winner = null; Round lastRound = this.getLastRound(); if (lastRound == null) { return winner; } int correct = GameConfiguration.numberLength(); for (Player player : lastRound.getAnswers().keySet()) { Answer answer = lastRound.getAnswers().get(player); if (answer.getCorrect() == correct) { winner = player; break; } } return winner; }