#!/usr/local/bin/ruby teams = %w(chomp nihan teambs fantastic atob rikka galliver) point = {} for t in teams point[t] = 0 end Dir.foreach(".") {|dir| next unless test(?d, dir) next if /^\./ =~ dir # dir is the same as users login name Dir.foreach(dir){|pt| next if /^\./ =~ pt file = "#{dir}/#{pt}" next unless test(?f, file) team = open(file, "r").gets.chomp! if point.has_key?(team) then point[team] += pt.to_i end } } puts '' for t in point.keys.sort{|x, y| point[y] <=> point[x]} print " \n \n", t, point[t] pt = point[t] print " \n" end puts '
" printf "%s (%3d)\n " printf '%d', pt, pt puts "
'