Skip to main content

Secrets from the Robocode masters: RoboLeague

Christian Schnell (Christian.D.Schnell@t-online.de), Student, Technical University of Berlin
Christian Schnell is currently finishing his Diplom in Informatik at the Technical University of Berlin and has worked on RDBM and other projects.

Summary:  This tip was published in the "Cloak and turret: Learn secrets from the Robocode masters" article in the May 2002 issue of the IBM developerWorks journal.

Date:  Jun 2002
Level:  Introductory
Activity:  1831 views

Sooner or later, many engaged robot authors want to learn about the others. What other robots are out there? Which of them can defeat my bot, who had better not challenge me and why? This is how I felt after a while, so I surfed around and found out that there is a need for RoboLeague.

Design a league

There are several ways to approach building a league. My initial idea was to have a global, open-ended league of robots. The set of robots should be allowed to change and updates to individual robots should be allowed without affecting their rank. As I found more than 200 robot classes, I decided on the well-known league/division model that is applied often in sports to reduce the number of fights (which, of course, grows exponentially with the league size). This model splits the league into several divisions, plays them through, promotes and demotes at neighboring divisions, and calls that a season. This model is open-ended in contrast to tournament models, but there is a good chance that tournament models will be supported in the future.

Cooperatively, Mathew Nelson (creator of Robocode) and I worked out proper interfaces for the Robocode game engine to use the engine as an object, instead of only as a process. This (together with other improvements) reduced the time for a single battle around factor 10 and cleared the path for bigger division sizes. A second obstacle I came across was non-conforming robot names. To solve this, robots have editable names in RoboLeague.

Early in the design, I decided to present results to the user in HTML, making it easy to publish them on the Internet. I turned that design decision into an opportunity to get in touch with Extensible Markup Language (XML) in Java programming. Consequently, all persistent data produced by RoboLeague is formatted in XML, and the HTML pages are produced by means of XSL Transformations (XSLT). (The XSLT files are editable to the user, yielding something like HTML "skins.") I will use XSLT XML to XML transformations to implement (the unavoidable) updates on the persistent XML structures, avoiding data loss as much as possible.

Internally, RoboLeague is composed of:

  • Robot directory. Maps between symbolic and Robocode robot class and versions. Figure 1 shows the Robot directory window, displaying the known robots currently installed along with their name, class name, and version.

  • Grouping engine. Uses the Robocode game engine and implements the execution of groupings (simple battles with symbolic names) on it.

  • Division engine. Uses a Grouping engine and implements the execution of a division's seasons on it.

  • League engine. Uses a Division engine and implements the execution of a league's seasons on it and the GUI classes.

Figure 1. The robot directory window, showing which known robots are currently installed (among other things)
The robot directory window, showing which known robots are currently installed (among other things)

Note that Grouping, Division, and League are different competition models. Each of them is designed as an engine class, an engine listener interface, and a data model class that encapsulates the engine's setup and results data. RoboLeague keeps XML in the outermost classes to make it one of several ways of storing data model objects persistently. This approach allows external projects to easily embed each engine. Other tournament-like competition models may be added in the future.

Apart from the absolute ranking (all divisions concatenated), an individual results page is produced for each robot, on which any 1-on-1 meeting that it has fought in the past is considered and shown summed per opponent. Figure 2 shows part of the GUI for league setup.


Figure 2. Super league setup
Super league setup

Figures 3 and 4 show the results for a season and individual robot, respectively. You can clearly see there that every robot has its strengths (well, almost) and weaknesses. At the end, every one of them has their own little challenge.


Figure 3. The HTML results front page, showing the results of the latest season
The HTML results front page, showing the results of the latest season

Figure 4. The HTML details page for robot cs.Lurch
The HTML details page for robot cs.Lurch

Host or participate in a league

From the RoboLeague Web page (see Resources), download RoboLeague and start your own private league today. Alternatively, join a league, such as The Gladiatorial League, or declare yourself the administrator of a public league and post rules for participants like the following to start your own tournaments:

  1. Download Robocode from the IBM alphaWorks Robocode Web site.
  2. Create a bot.
  3. Upload your bot to the tournament site.
  4. Check back in a week to see the current results and standings of your bot.
  5. Download opponents that have beaten you and fine tune your robot strategies.
  6. Upload your improved bot to the tournament site and see if you improve in the standings.

Want to enter a tournament and see how your own bot fares against the competition? Visit the IBM alphaWorks Robocode Web page (see Resources) to find the latest tournaments and learn how to enter them.


Resources

  • Read all of the Secrets from the Robocode masters . This page will be updated as new tips become available.

  • Robocode's creator, Mathew Nelson, maintains the official Robocode site. This should be the first stop for anyone serious about Robocode.

  • RoboLeague by Christian Schnell is a league and season manager for Robocode. It ensures that all possible groupings indeed play their matches, manages the results, and produces HTML status reports.

  • "Rock 'em, sock 'em Robocode" (developerWorks, January 2002) disarms Robocode and starts you on your way to building your own customized lean, mean, fighting machine.

  • In "Rock 'em, sock 'em Robocode: Round 2" (developerWorks, May 2002), Sing Li looks at advanced robot construction and team play.

  • New to Java? Check out "Introduction to Java programming" (developerWorks, November 2004), a tutorial that steps you through the fundamentals of Java language programming.

  • developerWorks: Hundreds of articles about every aspect of Java programming.

About the author

Christian Schnell is currently finishing his Diplom in Informatik at the Technical University of Berlin and has worked on RDBM and other projects.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Java technology
ArticleID=243638
ArticleTitle=Secrets from the Robocode masters: RoboLeague
publish-date=062002
author1-email=Christian.D.Schnell@t-online.de
author1-email-cc=jaloi@us.ibm.com

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers