Skip to content

Instantly share code, notes, and snippets.

@memetor
Last active May 27, 2017 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memetor/70c954937f0ed57b2a2429b20c6968d5 to your computer and use it in GitHub Desktop.
Save memetor/70c954937f0ed57b2a2429b20c6968d5 to your computer and use it in GitHub Desktop.
AVA-Score-Plot

http://me2tor.blogspot.com/2017/05/ava.html

  • これは動かない
    • 試合データを添付していないため(mysqlのdumpやcsvなど
    • 実行当時とディレクトリ構成が変わっているため
  • 動かすときに必要だったもの
    • ruby 2.4
    • gnuplot
    • mysql (ActiveRecordの接続先)
  • ファイルの説明
    • 数字連番
      • *.rb データの加工や画像の出力をしたrubyスクリプト
      • *.png 出力された画像
    • Gemfile, Gemfile.lock
      • rubyが使うライブラリ(gem)の定義
      • bundlerが使う
    • erd.png
      • データベースの定義
  • 心残り
    • Jupyter Notebookで残そうとしたけど途中で力尽きた
require 'bundler'
Bundler.require
ActiveRecord::Base.establish_connection YAML.load_file 'config/database.yml'
class Match < ActiveRecord::Base
has_many :clan_results
has_many :player_results, through: :clan_results
OFFICIAL_RULE_ID = 3
ROUND_MISSION_ID = 1
DEMOLITION_MAP_IDS = [1,2,4,5,6,7,17,19,33,36,40,41,45,48,57,62,74]
ROUND = 7
CLAN_SIZE = 2
PLAYER_SIZE = 5
def valid_match?
return false unless rule_id == OFFICIAL_RULE_ID
return false unless mission_id == ROUND_MISSION_ID
return false unless map_id.in? DEMOLITION_MAP_IDS
return false unless clan_results.size == CLAN_SIZE
return false unless clan_results.map(&:score).max == ROUND
return false unless player_results.size == PLAYER_SIZE * CLAN_SIZE
return false unless player_results.group_by(&:clan_result_id).select {|_, x| x.size == PLAYER_SIZE}.size == CLAN_SIZE
true
end
end
class ClanResult < ActiveRecord::Base
has_many :player_results
end
class PlayerResult < ActiveRecord::Base
end
open "data/#{File.basename __FILE__, '.rb'}.csv", ?w do |f|
Match.preload(:player_results).find_each do |match|
next unless match.date.year.in? 2011..2016
f.puts [match.id, match.valid_match?].join ?,
end
end
require 'bundler'
Bundler.require
ActiveRecord::Base.establish_connection YAML.load_file 'config/database.yml'
class Match < ActiveRecord::Base
end
open 'data/match_id.csv', ?r do |input|
def input.lazy_each_slice &block
lines = []
while line = gets
lines << line.chomp
next if lines.size < 1_000
yield lines
lines.clear
end
yield lines
end
open 'data/match_time.csv', ?w do |output|
def output.puts_time match_ids
Match.select(:id, :date).where(id: match_ids).each do |i|
puts [i.id, i.date.year, i.date.month, i.date.wday, i.date.hour].join ?,
end
end
output.puts 'match_id,year,month,weekday,hour'
input.lazy_each_slice do |lines|
output.puts_time lines.map &:to_i
end
end
end
require 'bundler'
Bundler.require
module CountBy
# can not use `group_by` on large data
def count_by &block
Hash.new {|h,k| h[k] = 0}.tap do |h|
each do |i|
k = yield i
h[k] += 1
end
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call(self)
map {|i| yield i, memo}
end
end
class MatchTimeIO
include Enumerable
Row = Struct.new :match_id, :year, :month, :weekday, :hour
def each &block
open 'data/match_time.csv', ?r do |f|
f.gets # ignore header
while f.gets
row = Row.new *$_.chomp.split(?,).map(&:to_i)
yield row
end
end
end
end
table = MatchTimeIO.new
.extend(CountBy)
.count_by(&:hour)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
File.write "data/#{File.basename __FILE__, '.rb'}.csv",
table.sort_by(&:first)
.map {|k,v| [k, v.round(2)].join ?,}
.unshift('hour,percent')
.join(?\n)
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}.png")
p.title '時間帯別試合数比'
p.xlabel '時間帯'
p.ylabel '試合数比(%)'
p.set 'yr[0:25]'
p.set 'xrange[-0.5:23.5]'
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'boxes'
d.using = '0:2:xtic(1)'
end
end
end
require 'bundler'
Bundler.require
module CountBy
# can not use `group_by` on large data
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class MatchTimeIO
include Enumerable
Row = Struct.new :match_id, :year, :month, :weekday, :hour
def each &block
open 'data/match_time.csv', ?r do |f|
f.gets # ignore header
while f.gets
row = Row.new *$_.chomp.split(?,).map(&:to_i)
yield row
end
end
end
end
table = MatchTimeIO.new
.extend(CountBy)
.count_by(&:weekday)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
File.write "data/#{File.basename __FILE__, '.rb'}.csv",
table.sort_by(&:first)
.map {|k,v| [k, v.round(2)].join ?,}
.unshift('weekday,percent')
.join(?\n)
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}.png")
p.title '曜日別試合数比'
p.xlabel '曜日'
p.ylabel '試合数比(%)'
p.set 'yr[0:25]'
p.set "xtics ('日' 0, '月' 1, '火' 2, '水' 3, '木' 4, '金' 5, '土' 6)"
p.set 'xr[-0.5:6.5]'
x = [*0..6]
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'boxes'
end
end
end
require 'bundler'
Bundler.require
module CountBy
# can not use `group_by` on large data
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class MatchTimeIO
include Enumerable
Row = Struct.new :match_id, :year, :month, :weekday, :hour
def each &block
open 'data/match_time.csv', ?r do |f|
f.gets # ignore header
while f.gets
row = Row.new *$_.chomp.split(?,).map(&:to_i)
yield row
end
end
end
end
Key = Struct.new :weekday, :hour do
def weekday_name
%w(日 月 火 水 木 金 土)[weekday]
end
def name
"#{weekday_name}#{hour}"
end
end
table = MatchTimeIO.new
.extend(CountBy)
.count_by {|x| Key.new x.weekday, x.hour}
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
File.write "data/#{File.basename __FILE__, '.rb'}.csv",
table.sort_by(&:last)
.reverse
.map {|k,v| [k.name, v].join ?,}
.unshift('weekday-hour,percent')
.join(?\n)
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png size 4000,600 font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}.png")
p.title '曜日時間帯別試合数比'
p.xlabel '曜日x時間帯'
p.ylabel '試合数比(%)'
series = table
.select {|k, v| v > 0.1}
.sort_by {|k, v| -v}
p.set 'yr[0:3.25]'
p.set 'ytics 0.25'
tics = series.map(&:first).map.with_index {|k,i| "'#{k.name}' #{i}"}.join ?,
p.set "xtics (#{tics})"
p.set "xr[-0.5:#{series.size + 0.5}]"
y = series.map(&:last).map {|x| x.round 2}
x = [*0..series.size]
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'boxes'
end
end
end
require 'bundler'
Bundler.require
module CountBy
# can not use `group_by` on large data
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class MatchTimeIO
include Enumerable
Row = Struct.new :match_id, :year, :month, :weekday, :hour
def each &block
open 'data/match_time.csv', ?r do |f|
f.gets # ignore header
while f.gets
row = Row.new *$_.chomp.split(?,).map(&:to_i)
yield row
end
end
end
end
SEASONS = [*2011..2016]
HOURS = [0,1,2,3,20,21,22,23]
seasons = SEASONS.map do |season|
table = MatchTimeIO.new
.select {|x| x.year == season && x.hour.in?(HOURS)}
.extend(CountBy)
.count_by(&:hour)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
[season, table]
end.to_h
seasons.each do |season, table|
File.write "data/#{File.basename __FILE__, '.rb'}_#{season}.csv",
table.sort_by(&:last)
.reverse
.map {|k,v| [k, v].join ?,}
.unshift('hour,percent')
.join(?\n)
end
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}.png")
p.title '年度別時間帯別試合数比'
p.set 'yrange [0:100]'
p.set 'ylabel "時間帯別の試合数比(100%)"'
p.set 'xlabel "年度"'
p.unset 'ytics'
p.set 'grid y'
p.set 'border 3'
p.set 'style data histograms'
p.set 'style histogram rowstacked'
p.set 'style fill solid border -1'
p.set 'boxwidth 0.75'
# memo
# outside : 凡例の位置をプロットの外に
# left top : 凡例の位置を図の左上に
# vertical Left : 凡例の並びを左縦書き方向に並べる
# reverse : 色を左に、名前を右に
# noenhanced : 拡張文字は使わない(default value?)
# nobox : 凡例の枠を表示しない
# autotitle : (使わない)入力データの列の先頭をタイトルにする
# columnhead : (使わない)先頭行をタイトルにする
p.set 'key outside left top vertical Left reverse nobox'
# memo
# invert : 凡例の並び順を逆に
# samplen : 凡例の横幅
# spacing : 凡例の高さ
# spacing : 凡例の高さ
# width : 凡例の全体枠の横幅
# height : 凡例の全体枠の縦幅
p.set 'key invert samplen 1 spacing 1 width 3 height 0 '
(SEASONS.size + 1).times do |i|
p.unset "paxis #{i + 1} tics"
end
xtics = SEASONS.map.with_index {|x, i| %("#{x}" #{i})}.join ?,
p.set "xtics (#{xtics})"
# {'season' => {'hour' => percent}} -> {'hour' => [percent]}
seasons
.sort_by(&:first)
.map {|_, table| table.sort_by &:first}
.flatten(1)
.reduce(Hash.new {|h,k| h[k] = []}) {|prev, (hour, percent)| prev[hour].push(percent) && prev}
.sort_by {|hour, _| hour < 4 ? hour + 24 : hour}
.each do |hour, percent_list|
p.data << Gnuplot::DataSet.new(percent_list) do |d|
d.title = "#{hour}時"
end
end
end
end
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class MatchIO
include Enumerable
COLUMNS = %i(match_id map_id date winner loser
winner_1_score winner_2_score winner_3_score winner_4_score winner_5_score
winner_1_death winner_2_death winner_3_death winner_4_death winner_5_death
loser_1_score loser_2_score loser_3_score loser_4_score loser_5_score
loser_1_death loser_2_death loser_3_death loser_4_death loser_5_death
)
Row = Struct.new *COLUMNS
def each &block
open 'data/match_score.csv', ?r do |f|
f.gets # ignore header
while f.gets
typed_cells = $_.chomp.split(?,).map.with_index do |cell, i|
case COLUMNS[i]
when :date then Time.parse cell
when :match_id, :map_id, :winner, :loser then Integer cell
else; Rational cell
end
end
yield Row.new *typed_cells
end
end
end
end
table = MatchIO.new
.extend(CountBy)
.count_by(&:loser)
.reject {|round, count| round == 7}
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
File.write "data/#{File.basename __FILE__, '.rb'}.csv",
table.sort_by(&:first)
.reverse
.map {|k,v| [k, v].join ?,}
.unshift('round,percent')
.join(?\n)
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}.png")
p.title 'ラウンド数分布'
p.set 'yrange [0:21]'
p.set 'xrange [-0.5:6.5]'
p.ylabel '出現率(%)'
p.xlabel 'ラウンド'
p.set 'style fill solid border -1'
p.set 'boxwidth 1'
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.notitle
d.with = 'boxes'
end
end
end
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class MatchIO
include Enumerable
COLUMNS = %i(match_id map_id date winner loser
winner_1_score winner_2_score winner_3_score winner_4_score winner_5_score
winner_1_death winner_2_death winner_3_death winner_4_death winner_5_death
loser_1_score loser_2_score loser_3_score loser_4_score loser_5_score
loser_1_death loser_2_death loser_3_death loser_4_death loser_5_death
)
Row = Struct.new *COLUMNS do
def winner_total_death
[winner_1_death, winner_2_death, winner_3_death, winner_4_death, winner_5_death].sum.to_i
end
end
def each &block
open 'data/match_score.csv', ?r do |f|
f.gets # ignore header
while f.gets
typed_cells = $_.chomp.split(?,).map.with_index do |cell, i|
case COLUMNS[i]
when :date then Time.parse cell
when :match_id, :map_id, :winner, :loser then Integer cell
else; Rational cell
end
end
yield Row.new *typed_cells
end
end
end
end
table = MatchIO.new
.extend(CountBy)
.count_by(&:winner_total_death)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
File.write "data/#{File.basename __FILE__, '.rb'}.csv",
table.sort_by(&:first)
.reverse
.map {|k,v| [k, v.round(3)].join ?,}
.unshift('total_death,percent')
.join(?\n)
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}.png")
p.title 'デス数分布'
p.set 'yrange [0:3.5]'
p.set 'xrange [-0.5:62.5]'
p.ylabel '出現率(%)'
p.xlabel 'デス数'
p.set 'style fill solid border -1'
p.set 'boxwidth 1'
x = table.keys.sort
y = x.map(&table.method(:fetch)).map {|i| i.round 3}
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.notitle
d.with = 'boxes'
end
end
end
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class MatchIO
include Enumerable
COLUMNS = %i(match_id map_id date winner loser
winner_1_score winner_2_score winner_3_score winner_4_score winner_5_score
winner_1_death winner_2_death winner_3_death winner_4_death winner_5_death
loser_1_score loser_2_score loser_3_score loser_4_score loser_5_score
loser_1_death loser_2_death loser_3_death loser_4_death loser_5_death
)
Team = Struct.new :round, *%w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
AT_ASSIST_SISTEM = Time.parse '2015-01-19 11:00:00 UTC'
Row = Struct.new *COLUMNS do
def teams
%w(winner loser).map do |side|
round = send side
scores = %w(score death)
.map {|indicator| (1..5).map {|i| "#{side}_#{i}_#{indicator}"}}
.flatten
.map(&method(:send))
.map(&:ceil)
Team.new round, *scores
end
end
def after_assist_system?
date > AT_ASSIST_SISTEM
end
end
def each &block
open 'data/match_score.csv', ?r do |f|
f.gets # ignore header
while f.gets
typed_cells = $_.chomp.split(?,).map.with_index do |cell, i|
case COLUMNS[i]
when :date then Time.parse cell
when :match_id, :map_id, :winner, :loser then Integer cell
else; Rational cell
end
end
yield Row.new *typed_cells
end
end
end
end
open 'data/match_score_after_assist.csv', ?w do |f|
f.puts MatchIO::Team.members.join ?,
MatchIO.new.each do |row|
next unless row.after_assist_system?
row.teams.each do |team|
f.puts team.values.join ?,
end
end
end
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
teams = TeamIO.new.map &:itself
# plot
dump = TeamIO::SCORES.reduce({}) do |prev, indicator|
table = teams
.extend(CountBy)
.count_by(&indicator)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_#{indicator}.png")
prefix, suffix = indicator.to_s.split ?_
name =
case prefix
when 'score' then 'スコア'
when 'death' then 'デス'
end
rank = "#{suffix.to_i}位"
p.title "#{rank}の#{name}の分布"
p.set 'yrange [0:25]'
p.set "xrange [-0.5:#{prefix == 'score' ? 25 : 13}.5]"
p.ylabel '出現率(%)'
p.xlabel name
p.set 'style fill solid border -1'
p.set 'boxwidth 1'
x = table.keys.sort
y = x.map(&table.method(:fetch)).map {|i| i.round 3}
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.notitle
d.with = 'boxes'
end
end
end
prev[indicator] = table
prev
end
# dump data
File.write "data/#{File.basename __FILE__, '.rb'}.yml", dump.to_yaml
# join png
# Require imagemagic
%w(score death).each do |side|
out = "data/#{File.basename __FILE__, '.rb'}_#{side}.png"
files = TeamIO::SCORES.select {|x| /#{side}/ =~ x.to_s}.map do |indicator|
"data/#{File.basename __FILE__, '.rb'}_#{indicator}.png"
end
`convert +append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
end
out = "data/#{File.basename __FILE__, '.rb'}.png"
files = %w(score death).map {|side| "data/#{File.basename __FILE__, '.rb'}_#{side}.png"}
`convert -append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
table = TeamIO.new
.reject {|x| x.round == 7}
.extend(CountBy)
.count_by(&:round)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
File.write "data/#{File.basename __FILE__, '.rb'}.csv",
table.sort_by(&:first)
.reverse
.map {|k,v| [k, v].join ?,}
.unshift('round,percent')
.join(?\n)
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png font "azukifontP"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}.png")
p.title 'ラウンド数分布'
p.set 'yrange [0:21]'
p.set 'xrange [-0.5:6.5]'
p.ylabel '出現率(%)'
p.xlabel 'ラウンド'
p.set 'style fill solid border -1'
p.set 'boxwidth 1'
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.notitle
d.with = 'boxes'
end
end
end
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def total_score
[score_1, score_2, score_3, score_4, score_5].sum
end
def total_death
[death_1, death_2, death_3, death_4, death_5].sum
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
teams = TeamIO.new.map &:itself
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "azukifontP"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_score.png")
p.title 'チーム合計スコア分布'
p.set 'yrange [0:5]'
p.set 'xrange [-0.5:90]'
p.ylabel '出現率(%)'
p.xlabel 'スコア'
p.set 'style fill transparent solid 0.75 noborder'
p.set 'boxwidth 1'
# winner
table = teams
.select {|x| x.round == 7}
.extend(CountBy)
.count_by(&:total_score)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '勝利チーム'
d.with = 'boxes'
end
# loser
table = teams
.reject {|x| x.round == 7}
.extend(CountBy)
.count_by(&:total_score)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '敗北チーム'
d.with = 'boxes'
end
end
end
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "azukifontP"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_death.png")
p.title 'チーム合計デス分布'
# p.set 'yrange [0:5]'
# p.set 'xrange [-0.5:90]'
p.ylabel '出現率(%)'
p.xlabel 'デス'
p.set 'style fill transparent solid 0.75 noborder'
p.set 'boxwidth 1'
# winner
table = teams
.select {|x| x.round == 7}
.extend(CountBy)
.count_by(&:total_death)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '勝利チーム'
d.with = 'boxes'
end
# loser
table = teams
.reject {|x| x.round == 7}
.extend(CountBy)
.count_by(&:total_death)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
puts table
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '敗北チーム'
d.with = 'boxes'
end
end
end
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def win?
round == 7
end
def total_score
[score_1, score_2, score_3, score_4, score_5].sum
end
def total_death
[death_1, death_2, death_3, death_4, death_5].sum
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
scores = Hash.new {|h,k| h[k] = [0,0]}
deaths = Hash.new {|h,k| h[k] = [0,0]}
TeamIO.new.each do |team|
i = team.win? ? 0 : 1
scores[team.total_score][i] += 1
deaths[team.total_death][i] += 1
end
[
[scores, 'score'],
[deaths, 'death'],
].each do |table, indicator|
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "azukifontP"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_#{indicator}.png")
name = indicator == 'score' ? 'スコア' : 'デス'
p.title "合計#{name}別の勝率"
p.xlabel "合計#{name}"
p.ylabel '勝率(%)'
p.set 'yr[0:100]'
if indicator == 'score'
p.set 'xrange[30:90]'
else
p.set 'xrange[35:60]'
end
p.set 'xtics 5'
p.set 'mxtics 1'
p.set 'ytics 10'
p.set 'mytics 5'
x = table.keys.sort
y = x.map(&table.method(:fetch))
.map {|win, lose| (win * 100) / (win + lose).to_f }
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'linespoints'
end
end
end
end
File.write "data/#{File.basename __FILE__, '.rb'}.yml", [scores, deaths].to_yaml
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
module Stats
def mean
sum.to_f / size
end
def var
m = mean
map {|x| (x - m) ** 2}.sum / size
end
def sd
Math.sqrt var
end
end
module MRound
refine Numeric do
def m_round n
x = n * div(n)
return x if self == x
return [x, x + n].max_by(&:abs) if self + self == x + x + n
[x, x + n].min_by {|i| (i - self).abs}
end
end
end
using MRound
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def win?
round == 7
end
def sd_score
[score_1, score_2, score_3, score_4, score_5].extend(Stats).sd.m_round(0.25)
end
def sd_death
[death_1, death_2, death_3, death_4, death_5].extend(Stats).sd.m_round(0.25)
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
teams = TeamIO.new.map &:itself
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_score.png")
p.title 'スコア標準偏差の分布'
p.ylabel '出現率(%)'
p.xlabel 'スコア標準偏差'
p.set 'style fill transparent solid 0.75 noborder'
p.set 'xrange [0:10]'
# winner
table = teams
.select(&:win?)
.extend(CountBy)
.count_by(&:sd_score)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '勝利チーム'
d.with = 'boxes'
end
# loser
table = teams
.reject(&:win?)
.extend(CountBy)
.count_by(&:sd_score)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '敗北チーム'
d.with = 'boxes'
end
end
end
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_death.png")
p.title 'デス標準偏差の分布'
p.ylabel '出現率(%)'
p.xlabel 'デス標準偏差'
p.set 'style fill transparent solid 0.75 noborder'
p.set 'xrange [0:4]'
# winner
table = teams
.select(&:win?)
.extend(CountBy)
.count_by(&:sd_death)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '勝利チーム'
d.with = 'boxes'
end
# loser
table = teams
.reject(&:win?)
.extend(CountBy)
.count_by(&:sd_death)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '敗北チーム'
d.with = 'boxes'
end
end
end
# join png
# Require imagemagic
out = "data/#{File.basename __FILE__, '.rb'}.png"
files = ['score', 'death'].map do |i|
"data/#{File.basename __FILE__, '.rb'}_#{i}.png"
end
`convert +append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
module Stats
def mean
sum.to_f / size
end
def var
m = mean
map {|x| (x - m) ** 2}.sum / size
end
def sd
Math.sqrt var
end
end
module MRound
refine Numeric do
def m_round n
x = n * div(n)
return x if self == x
return [x, x + n].max_by(&:abs) if self + self == x + x + n
[x, x + n].min_by {|i| (i - self).abs}
end
end
end
using MRound
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def win?
round == 7
end
def sd_score
[score_1, score_2, score_3, score_4, score_5].extend(Stats).sd.m_round(0.25)
end
def sd_death
[death_1, death_2, death_3, death_4, death_5].extend(Stats).sd.m_round(0.25)
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
scores = Hash.new {|h,k| h[k] = [0,0]}
deaths = Hash.new {|h,k| h[k] = [0,0]}
TeamIO.new.each do |team|
i = team.win? ? 0 : 1
scores[team.sd_score][i] += 1
deaths[team.sd_death][i] += 1
end
[
[scores, 'score'],
[deaths, 'death'],
].each do |table, indicator|
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_#{indicator}.png")
name = indicator == 'score' ? 'スコア' : 'デス'
p.title "#{name}標準偏差毎の勝率"
p.xlabel "#{name}標準偏差"
p.ylabel '勝率(%)'
p.set 'yr[0:100]'
if indicator == 'score'
p.set 'xrange[0:10]'
else
p.set 'xrange[0:4]'
end
x = table.keys.sort
y = x.map(&table.method(:fetch))
.map {|win, lose| (win * 100) / (win + lose).to_f }
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'linespoints'
end
end
end
end
# join png
# Require imagemagic
out = "data/#{File.basename __FILE__, '.rb'}.png"
files = ['score', 'death'].map do |i|
"data/#{File.basename __FILE__, '.rb'}_#{i}.png"
end
`convert +append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
File.write "data/#{File.basename __FILE__, '.rb'}.yml", [scores, deaths].to_yaml
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
module MRound
refine Numeric do
def m_round n
x = n * div(n)
return x if self == x
return [x, x + n].max_by(&:abs) if self + self == x + x + n
[x, x + n].min_by {|i| (i - self).abs}
end
end
end
using MRound
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def win?
round == 7
end
def total_score
[score_1, score_2, score_3, score_4, score_5].sum
end
def top1_rate
return 100 if total_score == 0
(score_1 * 100 / total_score).to_i
end
def top2_rate
return 100 if total_score == 0
((score_1 + score_2) * 100 / total_score).to_i
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
teams = TeamIO.new.map &:itself
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_top1_rate.png")
p.title '(1位のスコア/チームスコア)%の分布'
p.ylabel '出現率(%)'
p.xlabel '(1位のスコア/チームスコア)%'
p.set 'style fill transparent solid 0.75 noborder'
p.set 'xrange [0:100]'
# winner
table = teams
.select(&:win?)
.extend(CountBy)
.count_by(&:top1_rate)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '勝利チーム'
d.with = 'boxes'
end
# loser
table = teams
.reject(&:win?)
.extend(CountBy)
.count_by(&:top1_rate)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '敗北チーム'
d.with = 'boxes'
end
end
end
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_top2_rate.png")
p.title '(1位+2位のスコア/チームスコア)%の分布'
p.ylabel '出現率(%)'
p.xlabel '(1位+2位のスコア/チームスコア)%'
p.set 'style fill transparent solid 0.75 noborder'
p.set 'xrange [0:100]'
# winner
table = teams
.select(&:win?)
.extend(CountBy)
.count_by(&:top2_rate)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '勝利チーム'
d.with = 'boxes'
end
# loser
table = teams
.reject(&:win?)
.extend(CountBy)
.count_by(&:top2_rate)
.extend(MapWith)
.map_with(->(x){x.values.sum}) {|(k, v), total| [k, v * 100 / total.to_f]}
.to_h
x = table.keys.sort
y = x.map &table.method(:fetch)
p.data << Gnuplot::DataSet.new([x,y]) do |d|
d.title = '敗北チーム'
d.with = 'boxes'
end
end
end
out = "data/#{File.basename __FILE__, '.rb'}.png"
files = ['top1_rate', 'top2_rate'].map do |rank|
"data/#{File.basename __FILE__, '.rb'}_#{rank}.png"
end
`convert +append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
module Stats
def mean
sum.to_f / size
end
def var
m = mean
map {|x| (x - m) ** 2}.sum / size
end
def sd
Math.sqrt var
end
end
module MRound
refine Numeric do
def m_round n
x = n * div(n)
return x if self == x
return [x, x + n].max_by(&:abs) if self + self == x + x + n
[x, x + n].min_by {|i| (i - self).abs}
end
end
end
using MRound
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def win?
round == 7
end
def total_score
[score_1, score_2, score_3, score_4, score_5].sum
end
def top1_rate
return 100 if total_score == 0
(score_1 * 100 / total_score).to_i
end
def top2_rate
return 100 if total_score == 0
((score_1 + score_2) * 100 / total_score).to_i
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
top1 = Hash.new {|h,k| h[k] = [0,0]}
top2 = Hash.new {|h,k| h[k] = [0,0]}
TeamIO.new.each do |team|
i = team.win? ? 0 : 1
top1[team.top1_rate][i] += 1
top2[team.top2_rate][i] += 1
end
[
[top1, 'top1'],
[top2, 'top2'],
].each do |table, indicator|
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_#{indicator}.png")
name = indicator == 'top1' ? '1位' : '1位+2位'
p.title "(#{name}のスコア/チームスコア)%毎の勝率"
p.xlabel "(#{name}のスコア/チームスコア)%"
p.ylabel '勝率(%)'
p.set 'yr[0:100]'
if indicator == 'score'
# p.set 'xrange[0:10]'
else
# p.set 'xrange[0:4]'
end
# p.set 'xtics 5'
# p.set 'mxtics 1'
# p.set 'ytics 10'
# p.set 'mytics 5'
x = table.keys.sort
y = x.map(&table.method(:fetch))
.map {|win, lose| (win * 100) / (win + lose).to_f }
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'linespoints'
end
end
end
end
# join png
# Require imagemagic
out = "data/#{File.basename __FILE__, '.rb'}.png"
files = ['top1', 'top2'].map do |rank|
"data/#{File.basename __FILE__, '.rb'}_#{rank}.png"
end
`convert +append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
File.write "data/#{File.basename __FILE__, '.rb'}.yml", [top1, top2].to_yaml
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
module Stats
def mean
sum.to_f / size
end
def var
m = mean
map {|x| (x - m) ** 2}.sum / size
end
def sd
Math.sqrt var
end
end
module MRound
refine Numeric do
def m_round n
x = n * div(n)
return x if self == x
return [x, x + n].max_by(&:abs) if self + self == x + x + n
[x, x + n].min_by {|i| (i - self).abs}
end
end
end
using MRound
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def win?
round == 7
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
scores = [*1..5].map do
Hash.new {|h,k| h[k] = [0,0]}
end
TeamIO.new.each do |team|
i = team.win? ? 0 : 1
scores.each.with_index(1) do |score, rank|
score[team.send("score_#{rank}")][i] += 1
end
end
scores.each.with_index(1) do |table, rank|
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_#{rank}.png")
p.title "#{rank}位のスコア毎の勝率"
p.xlabel "#{rank}位のスコア"
p.ylabel '勝率(%)'
p.set 'yr[0:100]'
x = table.keys.sort
y = x.map(&table.method(:fetch))
.map {|win, lose| (win * 100) / (win + lose).to_f }
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'linespoints'
end
end
end
end
# join png
# Require imagemagic
out = "data/#{File.basename __FILE__, '.rb'}.png"
files = [1,2,3,4,5].map do |rank|
"data/#{File.basename __FILE__, '.rb'}_#{rank}.png"
end
`convert +append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
File.write "data/#{File.basename __FILE__, '.rb'}.yml", scores.to_yaml
require 'bundler'
Bundler.require
module CountBy
def count_by &block
reduce(Hash.new {|h,k| h[k] = 0}) do |prev, i|
key = yield i
prev[key] += 1
prev
end
end
end
module MapWith
def map_with with, &block
memo = with.to_proc.call self
map {|i| yield i, memo}
end
end
module Stats
def mean
sum.to_f / size
end
def var
m = mean
map {|x| (x - m) ** 2}.sum / size
end
def sd
Math.sqrt var
end
end
class TeamIO
include Enumerable
SCORES = %w(score death).map {|indicator| (1..5).map {|i| :"#{indicator}_#{i}"}}.flatten
Team = Struct.new :round, *SCORES do
def win?
round == 7
end
def total_score
[score_1, score_2, score_3, score_4, score_5].sum
end
end
def each &block
open 'data/match_score_after_assist.csv', ?r do |f|
f.gets # ignore header
while f.gets
yield Team.new *$_.chomp.split(?,).map(&:to_i)
end
end
end
end
scores_by_total_score = Hash.new do |h, k|
scores = [*1..5].map do
Hash.new {|h,k| h[k] = [0,0]}
end
h[k] = scores
end
TeamIO.new.each do |team|
total_score = team.total_score
next unless total_score.in? [50, 60, 70]
i = team.win? ? 0 : 1
scores_by_total_score[total_score].each.with_index(1) do |score, rank|
score[team.send("score_#{rank}")][i] += 1
end
end
scores_by_total_score.each do |total_score, scores|
scores.each.with_index(1) do |table, rank|
Gnuplot.open do |g|
Gnuplot::Plot.new g do |p|
p.set 'term png truecolor font "Mikachan"'
p.set %(out "data/#{File.basename __FILE__, '.rb'}_#{total_score}_#{rank}.png")
p.title "合計スコアが#{total_score}のときの#{rank}位のスコア毎の勝率"
p.xlabel "#{rank}位のスコア"
p.ylabel '勝率(%)'
p.set 'yr[0:100]'
x = table.keys.sort
y = x.map(&table.method(:fetch))
.map {|win, lose| (win * 100) / (win + lose).to_f }
p.data << Gnuplot::DataSet.new([x, y]) do |d|
d.notitle
d.with = 'linespoints'
end
end
end
end
end
File.write "data/#{File.basename __FILE__, '.rb'}.yml", scores_by_total_score.to_yaml
# join png
# Require imagemagic
[50, 60, 70].each do |total_score|
out = "data/#{File.basename __FILE__, '.rb'}_#{total_score}.png"
files = [1,2,3,4,5].map do |rank|
"data/#{File.basename __FILE__, '.rb'}_#{total_score}_#{rank}.png"
end
`convert +append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
end
out = "data/#{File.basename __FILE__, '.rb'}.png"
files = [50, 60, 70].map {|total_score| "data/#{File.basename __FILE__, '.rb'}_#{total_score}.png"}
`convert -append #{files.join(' ')} #{out}`
files.each &FileUtils.method(:rm)
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'activerecord', require: ['active_record', 'active_support', 'active_support/core_ext']
gem 'mysql2'
gem 'gnuplot'
gem 'pry'
gem 'bundler', require: ['yaml', 'stringio', 'fileutils']
GEM
remote: https://rubygems.org/
specs:
activemodel (5.0.1)
activesupport (= 5.0.1)
activerecord (5.0.1)
activemodel (= 5.0.1)
activesupport (= 5.0.1)
arel (~> 7.0)
activesupport (5.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (7.1.4)
coderay (1.1.1)
concurrent-ruby (1.0.4)
gnuplot (2.6.2)
i18n (0.8.0)
method_source (0.8.2)
minitest (5.10.1)
mysql2 (0.4.5)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
slop (3.6.0)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
PLATFORMS
ruby
DEPENDENCIES
activerecord
bundler
gnuplot
mysql2
pry
BUNDLED WITH
1.14.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment