Robo Home | Simonton | Changes | Preferences | AllPages

I don't know the best place to do this, so here goes: I hacked together a mod for Roboleague to sort all the groupings in a season, so that when I compare between results files the bots are in the same place on the screen. It isn't pretty, but it works. I can't find licencing info on Roboleague, so I'm just going to paste my mods on here & let you paste them into the soure & compile. Please treat this code as "open source" & share any improvements you make!

It seems like roboleague kinda already does this - but not always. Maybe I broke it with some of my other mods ... I don't know. Anyway, this will ALWAYS sort them right.

This is in roboleague.XmlIO. Find the storeGroupings method and replace the first few lines with the following. Notice that the last line here is the first surviving line in the original file.

	private static final Comparator GROUPING_COMPARATOR = new Comparator<Grouping>() {
		public int compare(Grouping o1, Grouping o2) {
			if (o1.competitors.length != o2.competitors.length) {
				return o1.competitors.length - o2.competitors.length;
			for (int i = 0; i < o1.competitors.length; i++) {
				int comp = o1.competitors[i].compareTo(o2.competitors[i]);
				if (comp != 0) {
					return comp;
			return 0;

	protected void storeGroupings(Element parent, Collection groupings) {
		Grouping[] groups = new Grouping[groupings.size()];
		Arrays.sort(groups, GROUPING_COMPARATOR);
		for (Grouping grouping : groups) {
			if (grouping.getTerminated()) {

Robo Home | Simonton | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited September 30, 2006 2:22 EST by Simonton (diff)