[Home]RoboLeague/ScoreAverageAddOn

Robo Home | RoboLeague | Changes | Preferences | AllPages

A simple RoboLeague add-on by PEZ

Some of us more than others advocate long battles to gain real knowledge about a bots' strength. But at the same time we also need to measure the strength of a bot in shorter battles. Especially when it comes to RoboRumble@Home 1v1 performance. Hence the idea to average the score from several shorter battles. Hence the need for this add-on. Axe has already released a tool that can help with this. But I am the lazy type and need something more immediate. I hacked one of the XSLT's in the RoboLeague distribution jar. Namely "Season.xml".


Usage

  1. [Download it] and place it in your roboleague/xslt directory. (Create this directory if you don't have it).
  2. Start up the RoboLeague GUI.
  3. Open a "divisions" xml file (or create one and run some seasons).
  4. Choose '''Competition -> Transform results" from the RL menu.
  5. Choose '''Competition -> Browse results" from the RL menu.
You should see something like this:

It shows the results from a 100 battle, 3-rounds run. The results starts with a small table presenting an all-seasons average of all battle data. I've also added a "Score %" column since that is what counts in RoboRumble@Home. (Seems like Lacrimas still has an edge against CassiusClay in this Extreme Fast Learning (EFL) set-up. =)


Updates

Sep 3 2004 - The averages listing is now sorted by Score %. Like so: http://robowiki.net/robocode/uploads/pez/CCvsDT_35.html -- PEZ

Nov 17 2004 - Now the averager is aware of divisons where a "focused competitor" is used. Like so: http://pezius.com/robocode/saao_focus.html -- PEZ


Caveats

Remember to switch off any data saving in the competing bots if you want to get an accurate measure the bots' abilities in shorter battles. This is probably easy with your own bots. Possible with OpenSource bots. Maybe possible with some bots from a properties file. And impossible with many closed source bots. Ask the authors of these bots to either open source their bots (preferred I think), release a non-data-saving version of their bot (second best option) or add a configuration file feature.

This simple hack is mainly meant to deal with RL battle files with only two bots involved. But it also works with divisions where more than two bots duke it out. The score share is then a share of the total collected by all bots.

I really did this little thing for fun and it was a very fast thing. There may be all sorts of bugs and special cases I don't deal with. If it messes up your RL usage, just remove it from your roboleague/xslt directory when you don't intend to use it. (You must restart RoboLeague for this to take effect.)


Code

It was more than a year ago since I did any XSLT hacking whatsoever, and I have never really learnt how to do it properly. You XSLT purists, close your eyes! Here's the little change I've done to the original transformation style sheet:
  <xsl:template match="/LEAGUE">
    <xsl:if test="@focused_competitor_id = ''">
      <h2>Averages</h2>
        <p><div align="center"><table bgcolor="#fff7e7" border="2" cellspacing="0" cellpadding="3">
          <tr bgcolor="#ffdfb0">
            <td nowrap="">Robot</td>
            <td nowrap="">Score</td>
            <td nowrap="">Score %</td>
            <td nowrap="">Survival</td>
            <td nowrap="">Last surv. b.</td>
            <td nowrap="">Bullet dmg.</td>
            <td nowrap="">Bullet dmg. b.</td>
            <td nowrap="">2*Ram dmg.</td>
            <td nowrap="">Ram dmg. b.</td>
            <td nowrap="">#1st</td>
            <td nowrap="">#2nd</td>
          </tr>
          <xsl:for-each select="COMPETITOR">
            <xsl:sort select="sum(../SEASON/GROUPING/RESULTS[@id=current()/@id]/@total_score)" data-type="number" order="descending"/>
            <xsl:variable name="bot"><xsl:value-of select="@id"/></xsl:variable>
	    <xsl:variable name="seasons"><xsl:value-of select="count(../SEASON)"/></xsl:variable>
	    <xsl:variable name="scoreSum"><xsl:value-of select="sum(../SEASON/GROUPING/RESULTS/@total_score)"/></xsl:variable>
	    <xsl:variable name="score"><xsl:value-of select="sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@total_score)"/></xsl:variable>
            <tr>
              <td><xsl:value-of select="$bot"/></td>
              <td><xsl:value-of select="format-number($score div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(100 * $score div $scoreSum, '#.0')"/>%</td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@survival) div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@last_survivor_bonus) div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@bullet_damage) div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@bullet_damage_bonus) div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@ram_damage) div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@ram_damage_bonus) div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@n_first_rank) div $seasons, '#.0')"/></td>
              <td><xsl:value-of select="format-number(sum(../SEASON/GROUPING/RESULTS[@id=$bot]/@n_second_rank) div $seasons, '#.0')"/></td>
	    </tr>
          </xsl:for-each>
        </table></div></p>
      <hr size="2"></hr>
    </xsl:if>
...

Comments / Questions / Suggestions / Contributions

I always had to do this manually. Thanks PEZ i like that tool. --deathcon

Sorry, but the link that is on this site is wrong. --deathcon

Thanks! Now corrected. -- PEZ

Sorry, but the link seems to be broken again :( --Krabb

You can always extract the file from the source zip included with roboleague and paste PEZ modifications in it. -- Florent

Thanks for that hint Florent, it works now! -- Krabb


Robo Home | RoboLeague | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 4, 2006 21:32 EST by UnderDark (diff)
Search: