Difference between revisions of "Thread:Talk:RoboRumble/Client java version/reply (46)"

From Robowiki
Jump to navigation Jump to search
m (Reply to Client java version)
 
m
 
Line 1: Line 1:
I think that's just the RoboRumble client prioritizing battles. From <code>roborumble.txt</code>:
+
According to the code, it shouldn't be harmful. It's just to make sure the client has the JAR, and to prevent duplicates.
  
<pre>
+
<syntaxhighlight lang="java">
# If set to SERVER (recommended), a new battle file is created which
+
// Check that competitors exist
# will first of all contain priority battles for robots that that has
+
String jar1 = items[0].replace(' ', '_') + ".jar";
# priority over other robots until they have fought a specific number
+
boolean exists1 = (new File(botsrepository + jar1)).exists() && namesAll.contains(items[0]);
# of battles specified by the BATTLESPERBOT property. The number of
+
String jar2 = items[1].replace(' ', '_') + ".jar";
# battles fought by the individual robots are extracted from the
+
boolean exists2 = (new File(botsrepository + jar2)).exists() && namesAll.contains(items[1]);
# rating files, which are downloaded from the server if the DOWNLOAD
+
 
# property is set to YES. When no more priority battles are left,
+
// Add battles to priority battles list
# robots from the participants file are paired at random similar to
+
if (exists1 && exists2 && !priorityBattles.contains(record)) {
# GENERAL.
+
    priorityBattles.add(record);
</pre>
+
} else {
 +
    System.out.println("Ignoring: " + record);
 +
}
 +
</syntaxhighlight>

Latest revision as of 17:34, 6 September 2017

According to the code, it shouldn't be harmful. It's just to make sure the client has the JAR, and to prevent duplicates.

// Check that competitors exist
String jar1 = items[0].replace(' ', '_') + ".jar";
boolean exists1 = (new File(botsrepository + jar1)).exists() && namesAll.contains(items[0]);
String jar2 = items[1].replace(' ', '_') + ".jar";
boolean exists2 = (new File(botsrepository + jar2)).exists() && namesAll.contains(items[1]);

// Add battles to priority battles list
if (exists1 && exists2 && !priorityBattles.contains(record)) {
    priorityBattles.add(record);
} else {
    System.out.println("Ignoring: " + record);
}