• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


Commit MetaInfo

Révision1b3407692131e16a8af23434f41b381134bf2fc0 (tree)
l'heure2015-02-14 17:40:28
AuteurDaigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Message de Log

util/statistics.rb: Updated to investigate floodgate-600-10 games.

Change Summary

Modification

--- a/changelog
+++ b/changelog
@@ -1,3 +1,11 @@
1+2015-02-14 Daigo Moriwaki <daigo at debian dot org>
2+
3+ * util/statistics.rb:
4+ - Updated to investigate floodgate-600-10 games.
5+ Consult the result at
6+ http://www.sgtpepper.net/hyspro/diary/20150214.html.
7+ - Added a companion R script: histogram.R
8+
19 2015-01-20 Daigo Moriwaki <daigo at debian dot org>
210
311 * [mk_rate]
--- /dev/null
+++ b/utils/histogram.R
@@ -0,0 +1,53 @@
1+args <- commandArgs(TRUE)
2+file1<- args[1]
3+file2 <- args[2]
4+title <- args[3]
5+
6+print(file)
7+
8+d1 <- read.csv(file1, header=F)
9+d2 <- read.csv(file2, header=F)
10+
11+sink(file="summary1.txt", split=T)
12+summary(d1)
13+sink()
14+
15+con <- file("summary1.txt")
16+open(con)
17+summary_text <- readLines(con)
18+close(con)
19+
20+sink(file="summary2.txt", split=T)
21+summary(d2)
22+sink()
23+
24+con <- file("summary2.txt")
25+open(con)
26+summary_text <- readLines(con)
27+close(con)
28+
29+
30+png(sprintf("%s.png", file1))
31+
32+library(MASS)
33+par(mar = c(4.5, 4.5, 4.5, 5.5))
34+
35+max <- 60
36+
37+truehist(d1$V1, xlim=c(0,max), col="#66ff6640", border="#66ff66", axes = FALSE, xlab = "", ylab = "", prob=FALSE)
38+axis(side = 1) # x axis
39+axis(side = 2, col.axis = "#66ff66", col = "#66ff66") # left y axis
40+mtext("floodgate-900-0", side = 2, line=3)
41+
42+par(new = TRUE)
43+
44+truehist(d2$V1, xlim=c(0,max), col="#6699ff40", border="#6699ff", axes = FALSE, xlab = "", ylab = "", prob=FALSE)
45+axis(side = 4, col.axis = "#6699ff", col = "#6699ff") # right y axis
46+mtext("floodgate-600-0", side = 4, line=3)
47+
48+mtext(title, side=1, line=3)
49+
50+dev.off()
51+q()
52+
53+
--- a/utils/statistics.rb
+++ b/utils/statistics.rb
@@ -112,33 +112,24 @@ $states = State.new
112112
113113 def do_file(file)
114114 $OPT_REPEAT -= 1 if $OPT_REPEAT > 0
115- csa = CsaFileReader.new(file)
115+ csa = CsaFileReader.new(file, "EUC-JP")
116116
117- # See games between 2008/03 to 2009/07
118- return if csa.start_time.nil? ||
119- csa.start_time < Time.parse("2008/03/01") ||
120- csa.start_time >= Time.parse("2009/08/01")
121-
122- # Want to see complete games
117+ # Want to see completed games only
123118 $states.add csa.state
124119 return unless csa.state == "toryo"
125120
126- # Process monthly
121+ # 1. Process monthly
127122 $monthly.add(csa)
128123
129- # Process gametime
124+ # 2. Process gametime
130125 duration = (csa.end_time - csa.start_time).to_i
131- if duration > 2200
132- $stderr.puts "Too long game: #{file}"
133- return
134- end
135126 $gametime.add duration.to_i
136127
137- # Process movetime
128+ # 3. Process movetime
138129 values = csa.movetimes
139130 $movetime.add values
140131
141- #Process moves
132+ # 4. Process moves
142133 $moves.add values.size
143134
144135 rescue => ex