OSDN Git Service

Merge branch 'wdoor-stable'
[shogi-server/shogi-server.git] / utils / eval_graph.rb
index 782d254..3c373ec 100755 (executable)
@@ -8,7 +8,7 @@
 #   * On Debian, $ sudo apt-get install gnuplot
 #
 # Author::    Daigo Moriwaki <daigo at debian dot org>
 #   * 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$
 #
 #
 # $Id$
 #
@@ -142,7 +142,7 @@ module EvalGraph
     def eval_values
       moves = []
       comments.each_with_index do |c, i|
     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)]
       end
       moves.unshift 0
       [moves, comments.compact.unshift(0)]
@@ -171,7 +171,7 @@ module EvalGraph
     def eval_values
       moves = []
       comments.each_with_index do |c, i|
     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)]
       end
       moves.unshift 0
       [moves, comments.compact.unshift(0)]
@@ -207,7 +207,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|
   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
       plot.output   to_svg_file(csa_file)
       
       plot.title  title
@@ -224,8 +224,8 @@ def plot(csa_file, title, black, white, a_play_time)
       plot.size   "0.9,0.9"
       plot.key "left"
      
       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"
 
       plot.data << Gnuplot::DataSet.new( black.eval_values ) do |ds|
         ds.with  = "lines ls 1"
@@ -238,8 +238,8 @@ def plot(csa_file, title, black, white, a_play_time)
       end
 
       if a_play_time > 0
       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|
         plot.style "fill solid 0.25 noborder"
 
         plot.data << Gnuplot::DataSet.new( black.time_values(3000, a_play_time) ) do |ds|