X-Git-Url: http://git.sourceforge.jp/view?p=shogi-server%2Fshogi-server.git;a=blobdiff_plain;f=utils%2Fstatistics.rb;h=b931317deb52453a53f4afbdb96dcb7a03115aed;hp=f9ab9d87bc3ab1abdc0079de006e99c1ce796c2c;hb=7845c4a03df15f57dc4a185765d45119245a2529;hpb=50f249f958a1ea23aea3b267b9ca8018b1f79020 diff --git a/utils/statistics.rb b/utils/statistics.rb index f9ab9d8..b931317 100755 --- a/utils/statistics.rb +++ b/utils/statistics.rb @@ -1,11 +1,16 @@ -#!/usr/bin/ruby1.9.1 -# This program filters CSA files. For example, if you want only CSA files -# played by GPS vs Bonanza, -# $ ./csa-filter.rb --players gps-l,bonanza some_dir -# you will see such files under the some_dir directory. +#!/usr/bin/ruby +# This program shows statistics of CSA kifu files like following: +# - Monthly #games and #players +# - Game results +# - Time of each move +# - Time of each game +# - Moves of each game +# +# Sample command line: +# $ ./statistics.rb /dev/shm/floodgate # # Author:: Daigo Moriwaki -# Copyright:: Copyright (C) 2006-2008 Daigo Moriwaki +# Copyright:: Copyright (C) 2009-2012 Daigo Moriwaki # # $Id$ # @@ -109,14 +114,15 @@ def do_file(file) $OPT_REPEAT -= 1 if $OPT_REPEAT > 0 csa = CsaFileReader.new(file) + # See games between 2008/03 to 2009/07 + return if csa.start_time.nil? || + csa.start_time < Time.parse("2008/03/01") || + csa.start_time >= Time.parse("2009/08/01") + # Want to see complete games $states.add csa.state return unless csa.state == "toryo" - # See games between 2008/03 to 2009/07 - return if csa.start_time < Time.parse("2008/03/01") || - csa.start_time >= Time.parse("2009/08/01") - # Process monthly $monthly.add(csa)