module StudioGame::GameStats
Public Instance Methods
print_high_scores()
click to toggle source
# File lib/studio_game/game_stats.rb, line 39 def print_high_scores puts "\n#{title} High Scores:" players.sort.each do |player| puts player.print_score end end
print_stats()
click to toggle source
# File lib/studio_game/game_stats.rb, line 4 def print_stats puts format_section_title("game stats") print_strength_stats print_treasure_stats puts total_points print_high_scores end
print_strength_stats()
click to toggle source
# File lib/studio_game/game_stats.rb, line 12 def print_strength_stats strong_players, wimpy_players = players.partition { |player| player.strong? } puts "\nThere are #{strong_players.size} strong players:" strong_players.each do |player| puts player.print_health_status end puts "\nThere are #{wimpy_players.size} wimpy players:" wimpy_players.each do |player| puts player.print_health_status end end
print_treasure_stats()
click to toggle source
# File lib/studio_game/game_stats.rb, line 28 def print_treasure_stats players.each do |player| player.print_treasures end end
total_points()
click to toggle source
# File lib/studio_game/game_stats.rb, line 34 def total_points players.reduce(0) { |sum, player| sum += player.points } end