Method: StudioGame::Game#print_stats

Defined in:
lib/game_class.rb


83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/game_class.rb', line 83

def print_stats
    strong_players, wimpy_players = @players.partition { |player| player.strong? }
  
  puts "\n#{title} Statistics:"
  puts "\n#{strong_players.size} strong players:"
  strong_players.each do |player|
    print_name_and_health(player)
  end

  puts "\n#{wimpy_players.size} wimpy players:"
  wimpy_players.each do |player|
    print_name_and_health(player)
  end

  sorted_players = @players.sort{ |a, b| b.score <=> a.score}
  puts "\n#{title} High Scores:"
  sorted_players.each do |player|
    puts high_score_entry(player)
  end
  puts "\n(High scores have been saved to 'high_scores.txt')"

  @players.each do |player|
    puts "\n#{player.name}'s point totals:"
    puts "#{player.points} grand total points"
  end

  puts "\n#{total_points} total points from treasures found."

  @players.sort.each do |player|
    puts "\n#{player.name}'s point totals:"
    player.each_found_treasure do |treasure|
      puts "#{treasure.points} total #{treasure.name} points"
    end
    puts "#{player.points} grand total points"
  end

end