OSDN Git Service

Remove a debug message
[shogi-server/shogi-server.git] / utils / eval_graph.rb
index 782d254..a66983c 100755 (executable)
@@ -8,7 +8,7 @@
 #   * On Debian, $ sudo apt-get install gnuplot
 #
 # Author::    Daigo Moriwaki <daigo at debian dot org>
-# Copyright:: Copyright (C) 2006-2008  Daigo Moriwaki <daigo at debian dot org>
+# Copyright:: Copyright (C) 2006-2012 Daigo Moriwaki <daigo at debian dot org>
 #
 # $Id$
 #
@@ -81,6 +81,7 @@ module EvalGraph
       @regexp_comment = Regexp.new(/^'\*\*(.*)/)
       @flag = false
       @name = nil
+      @increment = 0
     end
 
     def reset
@@ -108,6 +109,8 @@ module EvalGraph
         @name = $1
       when /\$START_TIME:(.*)/
         @start_time = $1
+      when /^'Increment:(.*)/
+        @increment = $1.to_i
       end
     end
 
@@ -119,6 +122,7 @@ module EvalGraph
       values = []
       values << 1.0*y_max/play_time*consume
       @times.each do |t|
+        consume += @increment
         if consume == 0
           break
         end
@@ -142,7 +146,7 @@ module EvalGraph
     def eval_values
       moves = []
       comments.each_with_index do |c, i|
-        moves << i*2 + 1 if c
+        moves << i*2 if c
       end
       moves.unshift 0
       [moves, comments.compact.unshift(0)]
@@ -171,7 +175,7 @@ module EvalGraph
     def eval_values
       moves = []
       comments.each_with_index do |c, i|
-        moves << i*2 if c
+        moves << i*2+1 if c
       end
       moves.unshift 0
       [moves, comments.compact.unshift(0)]
@@ -207,7 +211,7 @@ def plot(csa_file, title, black, white, a_play_time)
   width = [black.comments.size, white.comments.size].max * 2 + 1
   Gnuplot.open do |gp|
     Gnuplot::Plot.new( gp ) do |plot|
-      plot.terminal "svg" # or png
+      plot.terminal "svg size 800 500 fixed" # or png
       plot.output   to_svg_file(csa_file)
       
       plot.title  title
@@ -224,8 +228,8 @@ def plot(csa_file, title, black, white, a_play_time)
       plot.size   "0.9,0.9"
       plot.key "left"
      
-      plot.style "line 1 linewidth 5 linetype 0 linecolor rgbcolor \"red\"" 
-      plot.style "line 2 linewidth 4 linetype 0 linecolor rgbcolor \"dark-green\"" 
+      plot.style "line 1 linewidth 5 linetype -1 linecolor rgbcolor \"red\""
+      plot.style "line 2 linewidth 4 linetype -1 linecolor rgbcolor \"dark-green\""
 
       plot.data << Gnuplot::DataSet.new( black.eval_values ) do |ds|
         ds.with  = "lines ls 1"
@@ -238,8 +242,8 @@ def plot(csa_file, title, black, white, a_play_time)
       end
 
       if a_play_time > 0
-        plot.style "line 5 linewidth 1 linetype 0 linecolor rgbcolor \"red\"" 
-        plot.style "line 6 linewidth 1 linetype 0 linecolor rgbcolor \"green\"" 
+        plot.style "line 5 linewidth 1 linetype -1 linecolor rgbcolor \"red\""
+        plot.style "line 6 linewidth 1 linetype -1 linecolor rgbcolor \"green\""
         plot.style "fill solid 0.25 noborder"
 
         plot.data << Gnuplot::DataSet.new( black.time_values(3000, a_play_time) ) do |ds|