Mercurial > hg > rlgallery-misc
comparison py/stats2.py @ 60:876786c55450
Reduce the score graphs' column widths.
More and narrower categories bring out more detail.
author | John "Elwin" Edwards |
---|---|
date | Wed, 21 Jan 2015 10:45:00 -0500 |
parents | 5cf88bd4e556 |
children |
comparison
equal
deleted
inserted
replaced
59:0037de90af8b | 60:876786c55450 |
---|---|
141 xlgraph.close() | 141 xlgraph.close() |
142 return | 142 return |
143 | 143 |
144 def mkscoregraph(game, scoredata): | 144 def mkscoregraph(game, scoredata): |
145 if isinstance(game, rlgall.ARogueGame): | 145 if isinstance(game, rlgall.ARogueGame): |
146 scorewidth = 1500 | 146 scorewidth = 1000 |
147 else: | 147 else: |
148 scorewidth = 1000 | 148 scorewidth = 500 |
149 scoregraph = SVGChart("{0}/score-{1}.svg".format(svgpath, game.uname)) | 149 scoregraph = SVGChart("{0}/score-{1}.svg".format(svgpath, game.uname)) |
150 scoregraph.style("ffff00") | 150 scoregraph.style("ffff00") |
151 scoregraph.write(framerect) | 151 scoregraph.write(framerect) |
152 scoregraph.write('<clipPath id="framer">\n') | 152 scoregraph.write('<clipPath id="framer">\n') |
153 scoregraph.write(framerect) | 153 scoregraph.write(framerect) |
154 scoregraph.write('</clipPath>\n') | 154 scoregraph.write('</clipPath>\n') |
155 scoredivs, scoremax = ylimits(max([ pt[1] for pt in scoredata ])) | 155 scoredivs, scoremax = ylimits(max([ pt[1] for pt in scoredata ])) |
156 scale = 500 / scoremax | 156 scale = 500 / scoremax |
157 for block, count in scoredata: | 157 for block, count in scoredata: |
158 n = block // scorewidth | 158 n = block // scorewidth |
159 barx = n * 75 + 100 | 159 barx = n * 50 + 100 |
160 barh = scale * count | 160 barh = scale * count |
161 bary = 550 - barh | 161 bary = 550 - barh |
162 if count > 0: | 162 if count > 0: |
163 scoregraph.write(bar3d(barx, 75, barh)) | 163 scoregraph.write(bar3d(barx, 50, barh)) |
164 scoregraph.write(xllabel.format(barx, block)) | 164 if n % 2 == 0: |
165 scoregraph.write(xllabel.format(barx, block)) | |
165 for yl in range(scoredivs + 1): | 166 for yl in range(scoredivs + 1): |
166 labeln = int(scoremax * yl / scoredivs) | 167 labeln = int(scoremax * yl / scoredivs) |
167 labelh = 550 + 8 - 500 * yl / scoredivs | 168 labelh = 550 + 8 - 500 * yl / scoredivs |
168 scoregraph.write(ylabel.format(labelh, labeln)) | 169 scoregraph.write(ylabel.format(labelh, labeln)) |
169 scoregraph.write(xlabelf.format("Score")) | 170 scoregraph.write(xlabelf.format("Score")) |
201 | 202 |
202 for game in rlgall.gamelist: | 203 for game in rlgall.gamelist: |
203 xldata = game.getXLCounts(15) | 204 xldata = game.getXLCounts(15) |
204 deepdata = game.getDepthCounts(30) | 205 deepdata = game.getDepthCounts(30) |
205 if isinstance(game, rlgall.ARogueGame): | 206 if isinstance(game, rlgall.ARogueGame): |
206 scorewidth = 1500 | 207 scorewidth = 1000 |
207 else: | 208 else: |
208 scorewidth = 1000 | 209 scorewidth = 500 |
209 scoredata = game.getScoreCounts(10, scorewidth) | 210 scoredata = game.getScoreCounts(15, scorewidth) |
210 mkxlgraph(game, xldata) | 211 mkxlgraph(game, xldata) |
211 mkscoregraph(game, scoredata) | 212 mkscoregraph(game, scoredata) |
212 mkdeepgraph(game, deepdata) | 213 mkdeepgraph(game, deepdata) |
213 | 214 |
214 exit() | 215 exit() |