X-Git-Url: http://git.sourceforge.jp/view?p=shogi-server%2Fshogi-server.git;a=blobdiff_plain;f=mk_rate;h=1f9e54a013df157fbb637803b26fded4f868dada;hp=fcfe3e7318723400c25adaaaca5d3ae09b8c37a2;hb=48caf92ecf5d5669a5ccef83bf351f612e8aab70;hpb=09bf2bfc8b6a996083cb3283259caf364a71a356 diff --git a/mk_rate b/mk_rate index fcfe3e7..1f9e54a 100755 --- a/mk_rate +++ b/mk_rate @@ -104,8 +104,9 @@ require 'yaml' require 'time' require 'getoptlong' -require 'gsl' +require 'set' require 'rubygems' +require 'gsl' require 'rgl/adjacency' require 'rgl/connected_components' @@ -123,6 +124,8 @@ DRAW_MARK = "draw" $players = Hash.new # Holds the last time when a player gamed $players_time = Hash.new { Time.at(0) } +# Holds history of input lines to check duplicated inputs +$history = Set.new ################################################# @@ -654,6 +657,12 @@ end # Parse a game result line # def parse(line) + if $history.include? line + $stderr.puts "[WARNING] Duplicated: #{line}" + return + end + $history.add line + time, state, black_mark, black_id, white_id, white_mark, file = line.split("\t") unless time && state && black_mark && black_id && white_id && white_mark && file