Skip to content
Commits on Source (6)
.metadata
target
build.xml
maven-build.xml
maven-build.properties
/plugins/dotnet/robocode.dotnet.samples/src/robocode.dotnet.samples.sln
/plugins/dotnet/robocode.dotnet.samples/src/robocode.dotnet.samples.suo
ucdetector_reports
/plugins/dotnet/*.suo
*.class
.recommenders
.sonarlint
robocode (1.9.3.3-1) unstable; urgency=medium
* New upstream version 1.9.3.3.
* Declare compliance with Debian Policy 4.2.1.
-- Markus Koschany <apo@debian.org> Thu, 13 Sep 2018 13:52:33 +0200
robocode (1.9.3.2-1) unstable; urgency=medium
* New upstream version 1.9.3.2.
......
......@@ -18,7 +18,7 @@ Build-Depends:
libpicocontainer-java,
libpicocontainer-java-doc,
maven-debian-helper
Standards-Version: 4.1.5
Standards-Version: 4.2.1
Homepage: http://robocode.sourceforge.net/
Vcs-Git: https://anonscm.debian.org/git/pkg-java/robocode.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/robocode.git
......
#!/usr/bin/make -f
PKD := $(abspath $(dir $(MAKEFILE_LIST)))
VER := $(shell dpkg-parsechangelog -l$(PKD)/changelog -SVersion | cut -d- -f1)
PKG := robocode
COMMIT := 895548cab62d73a6ca2233eeb13d4f6222cd6324
%:
dh $@
......@@ -21,23 +19,3 @@ override_dh_install:
$(RM) -r debian/robocode/usr/share/maven-repo
dh_install
.PHONY: get-orig-source
## http://wiki.debian.org/onlyjob/get-orig-source
get-orig-source: $(PKG)_$(VER).orig.tar.xz
@
$(PKG)_$(VER).orig.tar.xz:
@echo "# Cloning upstream git repository..."
git clone https://github.com/robo-code/robocode.git $(PKG)-$(VER)
@echo "# Clean-up..."
cd $(PKG)-$(VER) \
&& git checkout -b debiansource $(COMMIT) \
&& for F in $$(git ls-tree -r --name-only HEAD); \
do touch --no-dereference -d "$$(git log -1 --format="%ai" -- "$$F")" "$$F"; done \
&& $(RM) -r -v \
.git/ \
.gitignore
@echo "# Packing..."
find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \
| XZ_OPT="-6v" tar -caf "$(PKG)_$(VER).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
&& $(RM) -r "$(PKG)-$(VER)"
......@@ -84,4 +84,26 @@ NOTE: You might need to remove the 'rem' and change the following lines inside
correct Java version:
rem set JAVA_HOME=%JDK6_HOME%
rem set PATH=%JAVA_HOME%\bin;%PATH%
\ No newline at end of file
rem set PATH=%JAVA_HOME%\bin;%PATH%
INSTALL LIBRARIES INTO THE LOCAL MAVEN REPOSITORY
=================================================
Robocode will give compiler error when running mvnassembly the first time or if the jni4net version is rolled.
Make sure to run these commands:
mvn install:install-file -DgroupId=net.sf.jni4net -DartifactId=jni4net.n -Dversion=0.8.7.0 -Dpackaging=dotnet:library -Dfile=<robocode-work-dir>\plugins\dotnet\tools\lib\jni4net.n-0.8.7.0.dll
mvn install:install-file -DgroupId=net.sf.jni4net -DartifactId=jni4net.j -Dversion=0.8.7.0 -Dpackaging=jar -Dfile=<robocode-work-dir>\plugins\dotnet\tools\lib\jni4net.j-0.8.7.0.jar
mvn install:install-file -DgroupId=net.sf.jni4net -DartifactId=jni4net.n.w32.v20 -Dversion=0.8.7.0 -Dpackaging=dotnet:library -Dfile=<robocode-work-dir>\plugins\dotnet\tools\lib\jni4net.n.w32.v20-0.8.7.0.dll
mvn install:install-file -DgroupId=net.sf.jni4net -DartifactId=jni4net.n.w32.v40 -Dversion=0.8.7.0 -Dpackaging=dotnet:library -Dfile=<robocode-work-dir>\plugins\dotnet\tools\lib\jni4net.n.w32.v40-0.8.7.0.dll
mvn install:install-file -DgroupId=net.sf.jni4net -DartifactId=jni4net.n.w64.v20 -Dversion=0.8.7.0 -Dpackaging=dotnet:library -Dfile=<robocode-work-dir>\plugins\dotnet\tools\lib\jni4net.n.w64.v20-0.8.7.0.dll
mvn install:install-file -DgroupId=net.sf.jni4net -DartifactId=jni4net.n.w64.v40 -Dversion=0.8.7.0 -Dpackaging=dotnet:library -Dfile=<robocode-work-dir>\plugins\dotnet\tools\lib\jni4net.n.w64.v40-0.8.7.0.dll
mvn install:install-file -DgroupId=org.nunit -DartifactId=nunit.framework -Dversion=2.4.3.0 -Dpackaging=dotnet:library -Dfile=<robocode-work-dir>\plugins\dotnet\tools\lib\nunit.framework-2.4.3.0.dll
Where <robocode-work-dir> is the directory containing your Robocode sources, e.g. D:\robocode-work
\ No newline at end of file
......@@ -7,96 +7,139 @@
*/
package robocode.control;
import static net.sf.robocode.io.Logger.logError;
import static net.sf.robocode.io.Logger.logWarning;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Random;
/**
* The RandomFactory is used for controlling the generation of random numbers,
* and supports generating random numbers that are deterministic, which is
* useful for testing purposes.
*
* @author Pavel Savara (original)
* @author Xor (fixed for Java 8)
* @author Flemming N. Larsen (fixed for Java 8)
*
* @since 1.6.1
*/
public class RandomFactory {
private static Random randomNumberGenerator;
private static Random randomNumberGenerator = new Random();
private static boolean warningNotSupportedLogged;
private static boolean isDeterministic;
static {
randomNumberGenerator = new Random();
}
public boolean isDeterministic() {
return isDeterministic;
}
/**
* Returns the random number generator used for generating a stream of
* random numbers.
* Returns the random number generator used for generating a stream of random
* numbers.
*
* @return a {@link java.util.Random} instance.
* @see java.util.Random
*/
public static Random getRandom() {
if (randomNumberGenerator == null) {
try {
Math.random();
final Field field = Math.class.getDeclaredField("randomNumberGenerator");
final boolean savedFieldAccessible = field.isAccessible();
field.setAccessible(true);
randomNumberGenerator = (Random) field.get(null);
field.setAccessible(savedFieldAccessible);
} catch (NoSuchFieldException e) {
Field field = getRandomNumberGeneratorField();
if (field != null) {
try {
randomNumberGenerator = getRandomNumberGenerator(field);
} catch (IllegalAccessException e) {
logWarningNotSupported();
}
}
if (randomNumberGenerator == null) {
logWarningNotSupported();
randomNumberGenerator = new Random();
} catch (IllegalAccessException e) {
logError(e);
randomNumberGenerator = new Random();
}
}
return randomNumberGenerator;
}
private static Field getRandomNumberGeneratorField() {
try {
return Math.class.getDeclaredField("randomNumberGenerator");
} catch (NoSuchFieldException e) {
try {
final Class<?> clazz = Class.forName("java.lang.Math$RandomNumberGeneratorHolder");
return clazz.getDeclaredField("randomNumberGenerator");
} catch (NoSuchFieldException e1) {
logWarningNotSupported();
} catch (ClassNotFoundException e1) {
logWarningNotSupported();
}
}
return null;
}
private static Random getRandomNumberGenerator(Field field) throws IllegalAccessException {
Math.random();
final boolean savedFieldAccessible = field.isAccessible();
field.setAccessible(true);
randomNumberGenerator = (Random) field.get(null);
field.setAccessible(savedFieldAccessible);
return randomNumberGenerator;
}
/**
* Sets the random number generator instance used for generating a
* stream of random numbers.
* Sets the random number generator instance used for generating a stream of
* random numbers.
*
* @param random a {@link java.util.Random} instance.
* @param random
* a {@link java.util.Random} instance.
* @see java.util.Random
*/
public static void setRandom(Random random) {
randomNumberGenerator = random;
try {
Math.random();
final Field field = Math.class.getDeclaredField("randomNumberGenerator");
final boolean savedFieldAccessible = field.isAccessible();
field.setAccessible(true);
field.set(null, randomNumberGenerator);
field.setAccessible(savedFieldAccessible);
} catch (NoSuchFieldException e) {
Field field = getRandomNumberGeneratorField();
if (field != null) {
try {
setRandomNumberGenerator(field);
} catch (Exception e) {
logWarningNotSupported();
}
} else {
logWarningNotSupported();
} catch (IllegalAccessException e) {
logError(e);
}
}
private static void setRandomNumberGenerator(Field field) throws IllegalAccessException, NoSuchFieldException {
Math.random();
final boolean savedFieldAccessible = field.isAccessible();
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
final boolean savedModifiersAccessible = modifiersField.isAccessible();
modifiersField.setAccessible(true);
try {
int oldModifiers = field.getModifiers();
try {
modifiersField.setInt(field, oldModifiers & ~Modifier.FINAL);
field.set(null, randomNumberGenerator);
} finally {
modifiersField.setInt(field, oldModifiers);
}
} finally {
modifiersField.setAccessible(savedModifiersAccessible);
}
// TODO ZAMO using Robot classloader inject seed also for all instances being created by robots
field.setAccessible(savedFieldAccessible);
}
/**
* Resets the random number generator instance to be deterministic when
* generating random numbers.
*
* @param seed the seed to use for the new deterministic random generator.
* @param seed
* the seed to use for the new deterministic random generator.
*/
public static void resetDeterministic(long seed) {
setRandom(new Random(seed));
......@@ -104,14 +147,14 @@ public class RandomFactory {
}
/**
* Logs a warning that the deterministic random feature is not supported by the JVM.
* Logs a warning that the deterministic random feature is not supported by the
* JVM.
*/
private static void logWarningNotSupported() {
if (!(warningNotSupportedLogged || System.getProperty("RANDOMSEED", "none").equals("none"))) {
logWarning(
"The deterministic random generator feature is not supported by this JVM:\n"
+ System.getProperty("java.vm.vendor") + " " + System.getProperty("java.vm.name") + " "
+ System.getProperty("java.vm.version"));
logWarning("The deterministic random generator feature is not supported by this JVM:\n"
+ System.getProperty("java.vm.vendor") + " " + System.getProperty("java.vm.name") + " "
+ System.getProperty("java.vm.version"));
warningNotSupportedLogged = true;
}
......
......@@ -51,7 +51,7 @@ public class BattleManager implements IBattleManager {
private volatile IBattle battle;
private Thread battleThread;
private BattleProperties battleProperties = new BattleProperties();
private BattleProperties battleProperties;
private final BattleEventDispatcher battleEventDispatcher;
......@@ -69,6 +69,7 @@ public class BattleManager implements IBattleManager {
this.hostManager = hostManager;
this.battleEventDispatcher = battleEventDispatcher;
Logger.setLogListener(battleEventDispatcher);
battleProperties = new BattleProperties(properties);
}
public synchronized void cleanup() {
......
......@@ -8,6 +8,7 @@
package net.sf.robocode.battle;
import net.sf.robocode.settings.ISettingsManager;
import robocode.AdvancedRobot;
import robocode.Robot;
import robocode.control.RobotSetup;
......@@ -51,6 +52,19 @@ public class BattleProperties implements Serializable {
private final Properties props = new Properties();
public BattleProperties() {
}
public BattleProperties(ISettingsManager properties) {
battlefieldWidth = properties.getBattleDefaultBattlefieldWidth();
battlefieldHeight = properties.getBattleDefaultBattlefieldHeight();
numRounds = properties.getBattleDefaultNumberOfRounds();
gunCoolingRate = properties.getBattleDefaultGunCoolingRate();
inactivityTime = properties.getBattleDefaultInactivityTime();
hideEnemyNames = properties.getBattleDefaultHideEnemyNames();
sentryBorderSize = properties.getBattleDefaultSentryBorderSize();
}
/**
* Gets the battlefieldWidth.
*
......
......@@ -127,15 +127,21 @@ class Repository implements IRepository {
* {@inheritDoc}
*/
public IRepositoryItem getItem(String friendlyUrl) {
// Friendly urls containing ending asterix like "test.Robot* must be changed into "test.Robot".
// That is, contain no ending asterix.
if (friendlyUrl.endsWith("*")) {
friendlyUrl = friendlyUrl.substring(0, friendlyUrl.length() - 1);
}
IRepositoryItem repositoryItem = repositoryItems.get(friendlyUrl);
if (repositoryItem == null) {
repositoryItem = removedItems.get(friendlyUrl);
}
if (repositoryItem == null) {
// Friendly urls containing ending asterix like "test.Robot* must be changed into "test.Robot".
// That is, contain no ending asterix.
if (friendlyUrl.endsWith("*")) {
friendlyUrl = friendlyUrl.substring(0, friendlyUrl.length() - 1);
}
repositoryItem = repositoryItems.get(friendlyUrl);
if (repositoryItem == null) {
repositoryItem = removedItems.get(friendlyUrl);
}
}
return repositoryItem;
}
......
......@@ -180,29 +180,32 @@ public class ResultsUpload {
String data = "game=" + game + commonData;
boolean errsaved = false;
if (matchtype.equals("GENERAL") || matchtype.equals("SERVER")) {
errorsfound = errorsfound | senddata(game, data, outtxt, true, results, i, battlesnum, prioritybattles);
errsaved = senddata(game, data, outtxt, true, results, i, battlesnum, prioritybattles);
}
if (sizesfile.length() != 0) { // upload also related competitions
if (minibots.length() != 0 && !matchtype.equals("NANO") && !matchtype.equals("MICRO")
&& size.checkCompetitorsForSize(first[0], second[0], 1500)) {
data = "game=" + minibots + commonData;
errorsfound = errorsfound
| senddata(minibots, data, outtxt, true, results, i, battlesnum, prioritybattles);
errsaved = errsaved
| senddata(minibots, data, outtxt, !errsaved, results, i, battlesnum, prioritybattles);
}
if (microbots.length() != 0 && !matchtype.equals("NANO")
&& size.checkCompetitorsForSize(first[0], second[0], 750)) {
data = "game=" + microbots + commonData;
errorsfound = errorsfound
| senddata(microbots, data, outtxt, true, results, i, battlesnum, prioritybattles);
errsaved = errsaved
| senddata(microbots, data, outtxt, !errsaved, results, i, battlesnum, prioritybattles);
}
if (nanobots.length() != 0 && size.checkCompetitorsForSize(first[0], second[0], 250)) {
data = "game=" + nanobots + commonData;
errorsfound = errorsfound
| senddata(nanobots, data, outtxt, true, results, i, battlesnum, prioritybattles);
errsaved = errsaved
| senddata(nanobots, data, outtxt, !errsaved, results, i, battlesnum, prioritybattles);
}
}
errorsfound = errorsfound || errsaved;
}
// close files
......
......@@ -114,7 +114,7 @@ public class RobocodeCompilerFactory {
String compilerName = "Java Compiler (javac)";
String compilerBinary = "javac";
String compilerOptions = "-deprecation -g -source 1.6 -encoding UTF-8";
String compilerOptions = "-version";
boolean javacOK = testCompiler(compilerName, compilerBinary, console);
boolean ecjOK = false;
......
......@@ -13,8 +13,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
</organization>
<properties>
<project.build.sourceEncoding>cp1252</project.build.sourceEncoding>
<robocode.version>1.9.3.2</robocode.version> <!-- Any string, but no spaces (use '-' instead of space) -->
<robocode.dotnet.version>1.9.3.2</robocode.dotnet.version> <!-- Only X.X.X.X format -->
<robocode.version>1.9.3.3</robocode.version> <!-- Any string, but no spaces (use '-' instead of space) -->
<robocode.dotnet.version>1.9.3.3</robocode.dotnet.version> <!-- Only X.X.X.X format -->
<javadoc.additionalparam/>
</properties>
<repositories>
......
## Version 1.9.3.3 (09-04-2018)
## Version 1.9.3.3 (10-09-2018)
## Bug fix
* Fixed issue with the RobocodeEngine, which could not read robots in "developer mode" (marked with a asterix '*' character)
* [Bug-395][]: Roborumble client duplicates battle results on network error.
* [Bug-397][]: Robocode UI cannot remember battle settings upon restart.
* [Bug-399][]: RANDOMSEED option does not support Java 8.
* Thanks goes to bumfod for all 3 fixes above. :-)
* [Bug-400][]: Problem to compile Robot.
* The compiler options have been cut down to include only the -verbose option per default.
## Version 1.9.3.2 (04-04-2018) The Java 10 support release
......@@ -3057,6 +3063,10 @@ Currently, there is one known issue, which will be fixed with the next Beta or i
[Bug-392]: http://sourceforge.net/p/robocode/bugs/392/ (Bullets of the same bot collide at low bullet powers and high gun-cooling rate)
[Bug-393]: http://sourceforge.net/p/robocode/bugs/393/ (More frequent roborumble server checks)
[Bug-394]: http://sourceforge.net/p/robocode/bugs/394/ (HiDPI scaling causes visual glitches)
[Bug-395]: http://sourceforge.net/p/robocode/bugs/395/ (Roborumble client duplicates battle results on network error)
[Bug-397]: http://sourceforge.net/p/robocode/bugs/397/ (Robocode UI cannot remember battle settings upon restart)
[Bug-399]: http://sourceforge.net/p/robocode/bugs/399/ (RANDOMSEED option does not support Java 8)
[Bug-400]: http://sourceforge.net/p/robocode/bugs/400/ (Problem to compile Robot)
[Req-1]: http://sourceforge.net/p/robocode/feature-requests/1/ (Multiple or hyperthreading CPUs (most P4s) hangs Robocode)
[Req-2]: http://sourceforge.net/p/robocode/feature-requests/2/ (Keep window size of "New battle" window)
......