-
-
Save corbanbrook/1015468 to your computer and use it in GitHub Desktop.
dumb max
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def best_team(team_map) | |
best = nil | |
team_map.each {|x,team| if best == nil || team.win_loss_ratio() > best.win_loss_ratio() | |
best = team | |
end | |
} | |
best | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
team_map.map(&:win_loss_ratio).max
or
team_map.map { |t| t.win_loss_ratio }.max