Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
zhoudaxia | ba97cf4450 | |
zhoudaxia | ce72ad8a55 | |
zhoudaxia | 15f56c9d26 | |
zhoudaxia | 428f63be82 | |
zhoudaxia | 37cb8ae223 | |
zhoudaxia | 01614f6152 | |
zhoudaxia | 711da1c2e4 | |
zhoudaxia | 728a702a9d | |
zhoudaxia | 18653a1fe4 | |
zhoudaxia | cf4255bf7f | |
zhoudaxia | 3f28bbc589 | |
zhoudaxia | 289fd3897e | |
zhoudaxia | db49a0302a | |
zhoudaxia | 167ade0f7b | |
zhoudaxia | 1ccaad8189 |
|
@ -43,7 +43,8 @@ public class AutoExtract implements ActionListener {
|
||||||
|
|
||||||
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
|
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
|
||||||
extractJar.close();
|
extractJar.close();
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (is == null) {
|
if (is == null) {
|
||||||
|
@ -146,7 +147,6 @@ public class AutoExtract implements ActionListener {
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(null, message);
|
JOptionPane.showMessageDialog(null, message);
|
||||||
System.err.println(message);
|
System.err.println(message);
|
||||||
System.exit(0);
|
|
||||||
}
|
}
|
||||||
JarInputStream jarIS = null;
|
JarInputStream jarIS = null;
|
||||||
try {
|
try {
|
||||||
|
@ -219,8 +219,8 @@ public class AutoExtract implements ActionListener {
|
||||||
if (jarIS != null) {
|
if (jarIS != null) {
|
||||||
try {
|
try {
|
||||||
jarIS.close();
|
jarIS.close();
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,9 @@ public class AutoExtract implements ActionListener {
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
} catch (Exception t) {// For some reason Ubuntu 7 can cause a NullPointerException when trying to getting the LAF
|
} catch (Exception t) {// For some reason Ubuntu 7 can cause a NullPointerException when trying to getting the LAF
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
File suggestedDir;
|
File suggestedDir;
|
||||||
|
|
||||||
|
@ -334,7 +336,8 @@ public class AutoExtract implements ActionListener {
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Warning: " + file + " may be a symlink. It has been ignored");
|
System.out.println("Warning: " + file + " may be a symlink. It has been ignored");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Warning: Cannot determine canonical file for " + file + ". It has been ignored");
|
"Warning: Cannot determine canonical file for " + file + ". It has been ignored");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ package net.sf.robocode.core;
|
||||||
* @author Pavel Savara (original)
|
* @author Pavel Savara (original)
|
||||||
*/
|
*/
|
||||||
public abstract class ContainerBase {
|
public abstract class ContainerBase {
|
||||||
public static ContainerBase instance;
|
public static final ContainerBase instance;
|
||||||
|
|
||||||
protected abstract <T> T getBaseComponent(java.lang.Class<T> tClass);
|
protected abstract <T> T getBaseComponent(java.lang.Class<T> tClass);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class FileUtil {
|
||||||
|
|
||||||
FileUtil.setCwd(new File(wd));
|
FileUtil.setCwd(new File(wd));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class Logger {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
PrintStream ps = new PrintStream(baos);
|
PrintStream ps = new PrintStream(baos);
|
||||||
|
|
||||||
t.printStackTrace(ps);
|
LOGGER.log("context", t);
|
||||||
ps.close();
|
ps.close();
|
||||||
return baos.toString();
|
return baos.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,6 @@ public class HiddenAccess {
|
||||||
Logger.logError("Can't find robocode.core-1.x.jar module near to robocode.jar");
|
Logger.logError("Can't find robocode.core-1.x.jar module near to robocode.jar");
|
||||||
Logger.logError("Class path: " + System.getProperty("robocode.class.path", null));
|
Logger.logError("Class path: " + System.getProperty("robocode.class.path", null));
|
||||||
}
|
}
|
||||||
System.exit(-1);
|
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
Logger.logError(e);
|
Logger.logError(e);
|
||||||
} catch (MyException e) {
|
} catch (MyException e) {
|
||||||
|
|
|
@ -61,6 +61,7 @@ public abstract class Event implements Comparable<Event>, Serializable {
|
||||||
* has a lower precedence, i.e. must be listed after the specified event.
|
* has a lower precedence, i.e. must be listed after the specified event.
|
||||||
* 0 means that the precedence of the two events are equal.
|
* 0 means that the precedence of the two events are equal.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int compareTo(Event event) {
|
public int compareTo(Event event) {
|
||||||
// Compare the time difference which has precedence over priority.
|
// Compare the time difference which has precedence over priority.
|
||||||
int timeDiff = (int) (time - event.time);
|
int timeDiff = (int) (time - event.time);
|
||||||
|
|
|
@ -103,38 +103,38 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
*
|
*
|
||||||
* @see #fieldWidth
|
* @see #fieldWidth
|
||||||
*/
|
*/
|
||||||
public static final int fieldWidth;
|
public int fieldWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the height of the battlefield.
|
* Contains the height of the battlefield.
|
||||||
*
|
*
|
||||||
* @see #fieldWidth
|
* @see #fieldWidth
|
||||||
*/
|
*/
|
||||||
public static final int fieldHeight;
|
public int fieldHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current number of other robots on the battle field.
|
* Current number of other robots on the battle field.
|
||||||
*/
|
*/
|
||||||
public static final int others;
|
public int others;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current energy of this robot, where 100 means full energy and 0 means no energy (dead).
|
* Current energy of this robot, where 100 means full energy and 0 means no energy (dead).
|
||||||
*/
|
*/
|
||||||
public static final int energy;
|
public int energy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current horizontal location of this robot (in pixels).
|
* Current horizontal location of this robot (in pixels).
|
||||||
*
|
*
|
||||||
* @see #robotY
|
* @see #robotY
|
||||||
*/
|
*/
|
||||||
public static final int robotX;
|
public int robotX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current vertical location of this robot (in pixels).
|
* Current vertical location of this robot (in pixels).
|
||||||
*
|
*
|
||||||
* @see #robotX
|
* @see #robotX
|
||||||
*/
|
*/
|
||||||
public static final int robotY;
|
public int robotY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current heading angle of this robot (in degrees).
|
* Current heading angle of this robot (in degrees).
|
||||||
|
@ -147,7 +147,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #turnBackLeft(int, int)
|
* @see #turnBackLeft(int, int)
|
||||||
* @see #turnBackRight(int, int)
|
* @see #turnBackRight(int, int)
|
||||||
*/
|
*/
|
||||||
public static final int heading;
|
public int heading;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current gun heading angle of this robot (in degrees).
|
* Current gun heading angle of this robot (in degrees).
|
||||||
|
@ -158,7 +158,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #turnGunTo(int)
|
* @see #turnGunTo(int)
|
||||||
* @see #bearGunTo(int)
|
* @see #bearGunTo(int)
|
||||||
*/
|
*/
|
||||||
public static final int gunHeading;
|
public int gunHeading;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current gun heading angle of this robot compared to its body (in degrees).
|
* Current gun heading angle of this robot compared to its body (in degrees).
|
||||||
|
@ -169,7 +169,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #turnGunTo(int)
|
* @see #turnGunTo(int)
|
||||||
* @see #bearGunTo(int)
|
* @see #bearGunTo(int)
|
||||||
*/
|
*/
|
||||||
public static final int gunBearing;
|
public int gunBearing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag specifying if the gun is ready to fire, i.e. gun heat <= 0.
|
* Flag specifying if the gun is ready to fire, i.e. gun heat <= 0.
|
||||||
|
@ -179,7 +179,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #fire()
|
* @see #fire()
|
||||||
* @see #fire(double)
|
* @see #fire(double)
|
||||||
*/
|
*/
|
||||||
public static final boolean gunReady;
|
public boolean gunReady;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current distance to the scanned nearest other robot (in pixels).
|
* Current distance to the scanned nearest other robot (in pixels).
|
||||||
|
@ -193,7 +193,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #scannedVelocity
|
* @see #scannedVelocity
|
||||||
* @see #scannedHeading
|
* @see #scannedHeading
|
||||||
*/
|
*/
|
||||||
public static final int scannedDistance = -1;
|
public int scannedDistance = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current angle to the scanned nearest other robot (in degrees).
|
* Current angle to the scanned nearest other robot (in degrees).
|
||||||
|
@ -207,7 +207,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #scannedVelocity
|
* @see #scannedVelocity
|
||||||
* @see #scannedHeading
|
* @see #scannedHeading
|
||||||
*/
|
*/
|
||||||
public static final int scannedAngle = -1;
|
public int scannedAngle = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current angle to the scanned nearest other robot (in degrees) compared to
|
* Current angle to the scanned nearest other robot (in degrees) compared to
|
||||||
|
@ -222,7 +222,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #scannedVelocity
|
* @see #scannedVelocity
|
||||||
* @see #scannedHeading
|
* @see #scannedHeading
|
||||||
*/
|
*/
|
||||||
public static final int scannedBearing = -1;
|
public int scannedBearing = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current velocity of the scanned nearest other robot.
|
* Current velocity of the scanned nearest other robot.
|
||||||
|
@ -239,7 +239,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #scannedEnergy
|
* @see #scannedEnergy
|
||||||
* @see #scannedHeading
|
* @see #scannedHeading
|
||||||
*/
|
*/
|
||||||
public static final int scannedVelocity = -99;
|
public int scannedVelocity = -99;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current heading of the scanned nearest other robot (in degrees).
|
* Current heading of the scanned nearest other robot (in degrees).
|
||||||
|
@ -253,7 +253,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #scannedEnergy
|
* @see #scannedEnergy
|
||||||
* @see #scannedVelocity
|
* @see #scannedVelocity
|
||||||
*/
|
*/
|
||||||
public static final int scannedHeading = -1;
|
public int scannedHeading = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current energy of scanned nearest other robot.
|
* Current energy of scanned nearest other robot.
|
||||||
|
@ -266,7 +266,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #scannedBearing
|
* @see #scannedBearing
|
||||||
* @see #scannedVelocity
|
* @see #scannedVelocity
|
||||||
*/
|
*/
|
||||||
public static final int scannedEnergy = -1;
|
public int scannedEnergy = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latest angle from where this robot was hit by a bullet (in degrees).
|
* Latest angle from where this robot was hit by a bullet (in degrees).
|
||||||
|
@ -276,7 +276,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #onHitByBullet()
|
* @see #onHitByBullet()
|
||||||
* @see #hitByBulletBearing
|
* @see #hitByBulletBearing
|
||||||
*/
|
*/
|
||||||
public static final int hitByBulletAngle = -1;
|
public int hitByBulletAngle = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latest angle from where this robot was hit by a bullet (in degrees)
|
* Latest angle from where this robot was hit by a bullet (in degrees)
|
||||||
|
@ -287,7 +287,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #onHitByBullet()
|
* @see #onHitByBullet()
|
||||||
* @see #hitByBulletAngle
|
* @see #hitByBulletAngle
|
||||||
*/
|
*/
|
||||||
public static final int hitByBulletBearing = -1;
|
public int hitByBulletBearing = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latest angle where this robot has hit another robot (in degrees).
|
* Latest angle where this robot has hit another robot (in degrees).
|
||||||
|
@ -297,7 +297,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #onHitRobot()
|
* @see #onHitRobot()
|
||||||
* @see #hitRobotBearing
|
* @see #hitRobotBearing
|
||||||
*/
|
*/
|
||||||
public static final int hitRobotAngle = -1;
|
public int hitRobotAngle = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latest angle where this robot has hit another robot (in degrees)
|
* Latest angle where this robot has hit another robot (in degrees)
|
||||||
|
@ -308,7 +308,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #onHitRobot()
|
* @see #onHitRobot()
|
||||||
* @see #hitRobotAngle
|
* @see #hitRobotAngle
|
||||||
*/
|
*/
|
||||||
public static final int hitRobotBearing = -1;
|
public int hitRobotBearing = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latest angle where this robot has hit a wall (in degrees).
|
* Latest angle where this robot has hit a wall (in degrees).
|
||||||
|
@ -318,7 +318,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #onHitWall()
|
* @see #onHitWall()
|
||||||
* @see #hitWallBearing
|
* @see #hitWallBearing
|
||||||
*/
|
*/
|
||||||
public static final int hitWallAngle = -1;
|
public int hitWallAngle = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latest angle where this robot has hit a wall (in degrees)
|
* Latest angle where this robot has hit a wall (in degrees)
|
||||||
|
@ -329,7 +329,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
* @see #onHitWall()
|
* @see #onHitWall()
|
||||||
* @see #hitWallAngle
|
* @see #hitWallAngle
|
||||||
*/
|
*/
|
||||||
public static final int hitWallBearing = -1;
|
public int hitWallBearing = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The robot event handler for this robot.
|
* The robot event handler for this robot.
|
||||||
|
@ -898,9 +898,9 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
||||||
// Make sure that we rescan if the robot did not execute anything this turn.
|
// Make sure that we rescan if the robot did not execute anything this turn.
|
||||||
// When the robot executes the currentTurn will automatically be increased by 1,
|
// When the robot executes the currentTurn will automatically be increased by 1,
|
||||||
// So when the turn stays the same, the robot did not take any action this turn.
|
// So when the turn stays the same, the robot did not take any action this turn.
|
||||||
|
if (lastTurn == currentTurn) {
|
||||||
peer.rescan(); // Spend a turn on rescanning
|
peer.rescan(); // Spend a turn on rescanning
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,7 @@ public abstract class _RobotBase implements IBasicRobot, Runnable {
|
||||||
* Called by the system to 'clean up' after your robot.
|
* Called by the system to 'clean up' after your robot.
|
||||||
* You may not override this method.
|
* You may not override this method.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
protected final void finalize() throws Throwable { // This method must be final so it cannot be overridden!
|
|
||||||
super.finalize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -115,7 +115,6 @@ public class RobocodeEngine implements IRobocodeEngine {
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
try {
|
try {
|
||||||
// Make sure close() is called to prevent memory leaks
|
// Make sure close() is called to prevent memory leaks
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class RobotSpecification implements java.io.Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Object fileSpecification;
|
private final transient Object fileSpecification;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String author;
|
private final String author;
|
||||||
private final String webpage;
|
private final String webpage;
|
||||||
|
|
|
@ -555,6 +555,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
// Notifying battle that we're asleep
|
// Notifying battle that we're asleep
|
||||||
// Sleeping and waiting for battle to wake us up.
|
// Sleeping and waiting for battle to wake us up.
|
||||||
try {
|
try {
|
||||||
|
while (!suitableCondition())
|
||||||
isSleeping.wait();
|
isSleeping.wait();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// We are expecting this to happen when a round is ended!
|
// We are expecting this to happen when a round is ended!
|
||||||
|
@ -581,7 +582,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
// Wake up the thread
|
// Wake up the thread
|
||||||
isSleeping.notifyAll();
|
isSleeping.notifyAll();
|
||||||
try {
|
try {
|
||||||
isSleeping.wait(10000);
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// Immediately reasserts the exception by interrupting the caller thread itself
|
// Immediately reasserts the exception by interrupting the caller thread itself
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
@ -607,10 +608,11 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
|
|
||||||
if (!isSleeping()) {
|
if (!isSleeping()) {
|
||||||
try {
|
try {
|
||||||
for (long i = millisWait; i > 0 && !isSleeping() && isRunning(); i--) {
|
while(long i = millisWait; i > 0 && !isSleeping() && isRunning()) {
|
||||||
isSleeping.wait(0, 999999);
|
isSleeping.wait(0, 999999);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
if (!isSleeping() && isRunning()) {
|
while (!isSleeping() && isRunning()) {
|
||||||
isSleeping.wait(0, nanosWait);
|
isSleeping.wait(0, nanosWait);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -809,6 +811,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
synchronized (isSleeping) {
|
synchronized (isSleeping) {
|
||||||
try {
|
try {
|
||||||
// Wait for the robot to go to sleep (take action)
|
// Wait for the robot to go to sleep (take action)
|
||||||
|
while (!suitableCondition())
|
||||||
isSleeping.wait(waitMillis, waitNanos);
|
isSleeping.wait(waitMillis, waitNanos);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
logMessage("Wait for " + getName() + " interrupted.");
|
logMessage("Wait for " + getName() + " interrupted.");
|
||||||
|
@ -848,7 +851,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
println("SYSTEM: You cannot call fire(NaN)");
|
println("SYSTEM: You cannot call fire(NaN)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (gunHeat > 0 || energy == 0) {
|
if (gunHeat > 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,17 +922,14 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
// Scan false means robot did not call scan() manually.
|
// Scan false means robot did not call scan() manually.
|
||||||
// But if we're moving, scan
|
// But if we're moving, scan
|
||||||
if (!scan) {
|
if (!scan) {
|
||||||
scan = (lastHeading != bodyHeading || lastGunHeading != gunHeading || lastRadarHeading != radarHeading
|
|
||||||
|| lastX != x || lastY != y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDead()) {
|
if (isDead()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// zap
|
|
||||||
if (zapEnergy != 0) {
|
|
||||||
zap(zapEnergy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,7 +942,6 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
// scan
|
// scan
|
||||||
if (scan) {
|
if (scan) {
|
||||||
scan(lastRadarHeading, robots);
|
scan(lastRadarHeading, robots);
|
||||||
turnedRadarWithGun = (lastGunHeading == lastRadarHeading) && (gunHeading == radarHeading);
|
|
||||||
scan = false;
|
scan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,7 +1033,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
this.updateEnergy(-Rules.ROBOT_HIT_DAMAGE);
|
this.updateEnergy(-Rules.ROBOT_HIT_DAMAGE);
|
||||||
otherRobot.updateEnergy(-Rules.ROBOT_HIT_DAMAGE);
|
otherRobot.updateEnergy(-Rules.ROBOT_HIT_DAMAGE);
|
||||||
|
|
||||||
if (otherRobot.energy == 0) {
|
if (otherRobot.energy) {
|
||||||
if (otherRobot.isAlive()) {
|
if (otherRobot.isAlive()) {
|
||||||
otherRobot.kill();
|
otherRobot.kill();
|
||||||
if (!teamFire && !otherRobot.isSentryRobot()) {
|
if (!teamFire && !otherRobot.isSentryRobot()) {
|
||||||
|
@ -1182,14 +1181,14 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
addEvent(new HitWallEvent(angle));
|
addEvent(new HitWallEvent(angle));
|
||||||
|
|
||||||
// only fix both x and y values if hitting wall at an angle
|
// only fix both x and y values if hitting wall at an angle
|
||||||
if ((bodyHeading % (Math.PI / 2)) != 0) {
|
if ((bodyHeading % (Math.PI / 2))) {
|
||||||
double tanHeading = tan(bodyHeading);
|
double tanHeading = tan(bodyHeading);
|
||||||
|
|
||||||
// if it hits bottom or top wall
|
// if it hits bottom or top wall
|
||||||
if (adjustX == 0) {
|
if (adjustX ) {
|
||||||
adjustX = adjustY * tanHeading;
|
adjustX = adjustY * tanHeading;
|
||||||
} // if it hits a side wall
|
} // if it hits a side wall
|
||||||
else if (adjustY == 0) {
|
else if (adjustY) {
|
||||||
adjustY = adjustX / tanHeading;
|
adjustY = adjustX / tanHeading;
|
||||||
} // if the robot hits 2 walls at the same time (rare, but just in case)
|
} // if the robot hits 2 walls at the same time (rare, but just in case)
|
||||||
else if (abs(adjustX / tanHeading) > abs(adjustY)) {
|
else if (abs(adjustX / tanHeading) > abs(adjustY)) {
|
||||||
|
@ -1423,7 +1422,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
|
|
||||||
// If we are moving normally and the breaking distance is more
|
// If we are moving normally and the breaking distance is more
|
||||||
// than remaining distance, enabled the overdrive flag.
|
// than remaining distance, enabled the overdrive flag.
|
||||||
if (Math.signum(distance * velocity) != -1) {
|
if (Math.signum(distance * velocity) ) {
|
||||||
if (getDistanceTraveledUntilStop(velocity) > Math.abs(distance)) {
|
if (getDistanceTraveledUntilStop(velocity) > Math.abs(distance)) {
|
||||||
isOverDriving = true;
|
isOverDriving = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1433,7 +1432,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
|
|
||||||
currentCommands.setDistanceRemaining(distance - velocity);
|
currentCommands.setDistanceRemaining(distance - velocity);
|
||||||
|
|
||||||
if (velocity != 0) {
|
if (!velocity) {
|
||||||
x += velocity * sin(bodyHeading);
|
x += velocity * sin(bodyHeading);
|
||||||
y += velocity * cos(bodyHeading);
|
y += velocity * cos(bodyHeading);
|
||||||
updateBoundingBox();
|
updateBoundingBox();
|
||||||
|
@ -1469,7 +1468,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
|
|
||||||
final double goalVel;
|
final double goalVel;
|
||||||
|
|
||||||
if (distance == Double.POSITIVE_INFINITY) {
|
if (distance ) {
|
||||||
goalVel = currentCommands.getMaxVelocity();
|
goalVel = currentCommands.getMaxVelocity();
|
||||||
} else {
|
} else {
|
||||||
goalVel = Math.min(getMaxVelocity(distance), currentCommands.getMaxVelocity());
|
goalVel = Math.min(getMaxVelocity(distance), currentCommands.getMaxVelocity());
|
||||||
|
@ -1486,7 +1485,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
final double decelTime = Math.max(1, Math.ceil(// sum of 0... decelTime, solving for decelTime using quadratic formula
|
final double decelTime = Math.max(1, Math.ceil(// sum of 0... decelTime, solving for decelTime using quadratic formula
|
||||||
(Math.sqrt((4 * 2 / Rules.DECELERATION) * distance + 1) - 1) / 2));
|
(Math.sqrt((4 * 2 / Rules.DECELERATION) * distance + 1) - 1) / 2));
|
||||||
|
|
||||||
if (decelTime == Double.POSITIVE_INFINITY) {
|
if (decelTime) {
|
||||||
return Rules.MAX_VELOCITY;
|
return Rules.MAX_VELOCITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1559,7 +1558,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zap(double zapAmount) {
|
private void zap(double zapAmount) {
|
||||||
if (energy == 0) {
|
if (!energy) {
|
||||||
kill();
|
kill();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1626,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setEnergy(double newEnergy, boolean resetInactiveTurnCount) {
|
private void setEnergy(double newEnergy, boolean resetInactiveTurnCount) {
|
||||||
if (resetInactiveTurnCount && (energy != newEnergy)) {
|
if (resetInactiveTurnCount && (energy)) {
|
||||||
battle.resetInactiveTurnCount(energy - newEnergy);
|
battle.resetInactiveTurnCount(energy - newEnergy);
|
||||||
}
|
}
|
||||||
energy = newEnergy;
|
energy = newEnergy;
|
||||||
|
|
|
@ -115,7 +115,7 @@ public final class RobotSnapshot implements Serializable, IXmlSerializable, IRob
|
||||||
private SerializableArc scanArc;
|
private SerializableArc scanArc;
|
||||||
|
|
||||||
/** Snapshot of the object with queued calls for Graphics object */
|
/** Snapshot of the object with queued calls for Graphics object */
|
||||||
private Object graphicsCalls;
|
private transient Object graphicsCalls;
|
||||||
|
|
||||||
/** Snapshot of debug properties */
|
/** Snapshot of debug properties */
|
||||||
private DebugProperty[] debugProperties;
|
private DebugProperty[] debugProperties;
|
||||||
|
|
|
@ -34,7 +34,7 @@ class BattleRecordInfo implements Serializable, IXmlSerializable {
|
||||||
int roundsCount;
|
int roundsCount;
|
||||||
BattleRules battleRules;
|
BattleRules battleRules;
|
||||||
Integer[] turnsInRounds;
|
Integer[] turnsInRounds;
|
||||||
List<BattleResults> results;
|
transient List<BattleResults> results;
|
||||||
|
|
||||||
public void writeXml(XmlWriter writer, SerializableOptions options) throws IOException {
|
public void writeXml(XmlWriter writer, SerializableOptions options) throws IOException {
|
||||||
writer.startElement("recordInfo"); {
|
writer.startElement("recordInfo"); {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Calendar;
|
||||||
* @author Flemming N. Larsen (original)
|
* @author Flemming N. Larsen (original)
|
||||||
*/
|
*/
|
||||||
class BattleRecorder {
|
class BattleRecorder {
|
||||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
|
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
|
||||||
|
|
||||||
private final RecordManager recordmanager;
|
private final RecordManager recordmanager;
|
||||||
private final ISettingsManager properties;
|
private final ISettingsManager properties;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import java.util.zip.ZipOutputStream;
|
||||||
* @author Pavel Savara (original)
|
* @author Pavel Savara (original)
|
||||||
*/
|
*/
|
||||||
public class RecordManager implements IRecordManager {
|
public class RecordManager implements IRecordManager {
|
||||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
|
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
|
||||||
|
|
||||||
private final ISettingsManager properties;
|
private final ISettingsManager properties;
|
||||||
|
|
||||||
|
@ -57,13 +57,6 @@ public class RecordManager implements IRecordManager {
|
||||||
recorder = new BattleRecorder(this, properties);
|
recorder = new BattleRecorder(this, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finalize() throws Throwable {
|
|
||||||
try {
|
|
||||||
cleanup();
|
|
||||||
} finally {
|
|
||||||
super.finalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cleanup() {
|
private void cleanup() {
|
||||||
cleanupStreams();
|
cleanupStreams();
|
||||||
|
|
|
@ -141,11 +141,11 @@ public class BattleResultsTableModel extends javax.swing.table.AbstractTableMode
|
||||||
case 2:
|
case 2:
|
||||||
String percent = "";
|
String percent = "";
|
||||||
|
|
||||||
if (totalScore != 0) {
|
if (!totalScore) {
|
||||||
percent = " (" + NumberFormat.getPercentInstance().format(statistics.getScore() / totalScore) + ")";
|
percent = " (" + NumberFormat.getPercentInstance().format(statistics.getScore() / totalScore) + ")";
|
||||||
}
|
}
|
||||||
return "" + (int) (statistics.getScore() + 0.5) + percent;
|
return "" + (int) (statistics.getScore() + 0.5) + percent;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
return "" + (int) (statistics.getSurvival() + 0.5);
|
return "" + (int) (statistics.getSurvival() + 0.5);
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ public final class RobocodeMain extends RobocodeMainBase {
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void uncaughtException(Thread thread, Throwable t) {
|
public void uncaughtException(Thread thread, Throwable t) {
|
||||||
t.printStackTrace();
|
LOGGER.log("context", t);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -144,7 +144,6 @@ public final class RobocodeMain extends RobocodeMainBase {
|
||||||
if (setup.battleFilename != null) {
|
if (setup.battleFilename != null) {
|
||||||
if (setup.replayFilename != null) {
|
if (setup.replayFilename != null) {
|
||||||
System.err.println("You cannot run both a battle and replay a battle record in the same time.");
|
System.err.println("You cannot run both a battle and replay a battle record in the same time.");
|
||||||
System.exit(8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup.exitOnComplete = true;
|
setup.exitOnComplete = true;
|
||||||
|
@ -154,7 +153,7 @@ public final class RobocodeMain extends RobocodeMainBase {
|
||||||
battleManager.startNewBattle(battleManager.loadBattleProperties(), false, enableCLIRecording);
|
battleManager.startNewBattle(battleManager.loadBattleProperties(), false, enableCLIRecording);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("The specified battle file '" + setup.battleFilename + "' was not found");
|
System.err.println("The specified battle file '" + setup.battleFilename + "' was not found");
|
||||||
System.exit(8);
|
|
||||||
}
|
}
|
||||||
} else if (setup.replayFilename != null) {
|
} else if (setup.replayFilename != null) {
|
||||||
setup.exitOnComplete = true;
|
setup.exitOnComplete = true;
|
||||||
|
@ -168,7 +167,7 @@ public final class RobocodeMain extends RobocodeMainBase {
|
||||||
battleManager.replay();
|
battleManager.replay();
|
||||||
} else {
|
} else {
|
||||||
System.err.println("The specified battle record file '" + setup.replayFilename + "' was not found");
|
System.err.println("The specified battle record file '" + setup.replayFilename + "' was not found");
|
||||||
System.exit(8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
@ -229,7 +228,7 @@ public final class RobocodeMain extends RobocodeMainBase {
|
||||||
setup.tps = Integer.parseInt(args[i + 1]);
|
setup.tps = Integer.parseInt(args[i + 1]);
|
||||||
if (setup.tps < 1) {
|
if (setup.tps < 1) {
|
||||||
Logger.logError("tps must be > 0");
|
Logger.logError("tps must be > 0");
|
||||||
System.exit(8);
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} else if (currentArg.equalsIgnoreCase("-minimize")) {
|
} else if (currentArg.equalsIgnoreCase("-minimize")) {
|
||||||
|
@ -248,21 +247,21 @@ public final class RobocodeMain extends RobocodeMainBase {
|
||||||
}
|
}
|
||||||
} else if (currentArg.equals("-?") || currentArg.equalsIgnoreCase("-help")) {
|
} else if (currentArg.equals("-?") || currentArg.equalsIgnoreCase("-help")) {
|
||||||
printUsage();
|
printUsage();
|
||||||
System.exit(0);
|
|
||||||
} else {
|
} else {
|
||||||
Logger.logError("Not understood: " + currentArg);
|
Logger.logError("Not understood: " + currentArg);
|
||||||
printUsage();
|
printUsage();
|
||||||
System.exit(8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File robotsDir = FileUtil.getRobotsDir();
|
File robotsDir = FileUtil.getRobotsDir();
|
||||||
|
|
||||||
if (robotsDir == null) {
|
if (robotsDir == null) {
|
||||||
System.err.println("No valid robot directory is specified");
|
System.err.println("No valid robot directory is specified");
|
||||||
System.exit(8);
|
|
||||||
} else if (!(robotsDir.exists() && robotsDir.isDirectory())) {
|
} else if (!(robotsDir.exists() && robotsDir.isDirectory())) {
|
||||||
System.err.println('\'' + robotsDir.getAbsolutePath() + "' is not a valid robot directory");
|
System.err.println('\'' + robotsDir.getAbsolutePath() + "' is not a valid robot directory");
|
||||||
System.exit(8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Default Toolkit must be set as soon as we know if we are going to use headless mode or not.
|
// The Default Toolkit must be set as soon as we know if we are going to use headless mode or not.
|
||||||
|
@ -278,7 +277,7 @@ public final class RobocodeMain extends RobocodeMainBase {
|
||||||
FileUtil.setCwd(new File(robocodeDir));
|
FileUtil.setCwd(new File(robocodeDir));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println(robocodeDir + " is not a valid directory to start Robocode in.");
|
System.err.println(robocodeDir + " is not a valid directory to start Robocode in.");
|
||||||
System.exit(8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class URLJarCollector {
|
||||||
private static final boolean sunJVM;
|
private static final boolean sunJVM;
|
||||||
private static boolean enabled;
|
private static boolean enabled;
|
||||||
private static Set<URL> urlsToClean = new HashSet<URL>();
|
private static Set<URL> urlsToClean = new HashSet<URL>();
|
||||||
|
URI uri = url.toURI();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
boolean localSunJVM = false;
|
boolean localSunJVM = false;
|
||||||
|
|
|
@ -56,7 +56,7 @@ public final class ExecCommands implements Serializable {
|
||||||
private List<BulletCommand> bullets = new ArrayList<BulletCommand>();
|
private List<BulletCommand> bullets = new ArrayList<BulletCommand>();
|
||||||
private List<TeamMessage> teamMessages = new ArrayList<TeamMessage>();
|
private List<TeamMessage> teamMessages = new ArrayList<TeamMessage>();
|
||||||
private List<DebugProperty> debugProperties = new ArrayList<DebugProperty>();
|
private List<DebugProperty> debugProperties = new ArrayList<DebugProperty>();
|
||||||
private Object graphicsCalls;
|
private transient Object graphicsCalls;
|
||||||
|
|
||||||
public ExecCommands() {
|
public ExecCommands() {
|
||||||
setMaxVelocity(Double.MAX_VALUE);
|
setMaxVelocity(Double.MAX_VALUE);
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class CpuManager implements ICpuManager { // NO_UCD (use default)
|
||||||
}
|
}
|
||||||
|
|
||||||
// to cheat optimizer, almost never happen
|
// to cheat optimizer, almost never happen
|
||||||
if (d == 0.0) {
|
if (d) {
|
||||||
Logger.logMessage("bingo!");
|
Logger.logMessage("bingo!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,6 @@ public class HostManager implements IHostManager {
|
||||||
|
|
||||||
public void initSecurity() {
|
public void initSecurity() {
|
||||||
JarJarURLConnection.register();
|
JarJarURLConnection.register();
|
||||||
new RobocodeSecurityPolicy(threadManager);
|
|
||||||
new RobocodeSecurityManager(threadManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,7 +423,7 @@ public final class EventManager implements IEventManager {
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
robotProxy.println("SYSTEM: " + ex.getClass().getName() + " occurred on " + event.getClass().getName());
|
robotProxy.println("SYSTEM: " + ex.getClass().getName() + " occurred on " + event.getClass().getName());
|
||||||
ex.printStackTrace(robotProxy.getOut());
|
LOGGER.log("context", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ public class RobotFileSystemManager {
|
||||||
updateDataFilesFromJar();
|
updateDataFilesFromJar();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class RobotOutputStream extends java.io.PrintStream {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
final PrintWriter writer = new PrintWriter(sw);
|
final PrintWriter writer = new PrintWriter(sw);
|
||||||
|
|
||||||
t.printStackTrace(writer);
|
LOGGER.log("context", t);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
|
||||||
int origLen = text.length();
|
int origLen = text.length();
|
||||||
|
|
|
@ -126,21 +126,21 @@ public class BasicRobotProxy extends HostingRobotProxy implements IBasicRobotPee
|
||||||
setMoveImpl(distance);
|
setMoveImpl(distance);
|
||||||
do {
|
do {
|
||||||
execute(); // Always tick at least once
|
execute(); // Always tick at least once
|
||||||
} while (getDistanceRemaining() != 0);
|
} while (getDistanceRemaining());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void turnBody(double radians) {
|
public void turnBody(double radians) {
|
||||||
setTurnBodyImpl(radians);
|
setTurnBodyImpl(radians);
|
||||||
do {
|
do {
|
||||||
execute(); // Always tick at least once
|
execute(); // Always tick at least once
|
||||||
} while (getBodyTurnRemaining() != 0);
|
} while (getBodyTurnRemaining());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void turnGun(double radians) {
|
public void turnGun(double radians) {
|
||||||
setTurnGunImpl(radians);
|
setTurnGunImpl(radians);
|
||||||
do {
|
do {
|
||||||
execute(); // Always tick at least once
|
execute(); // Always tick at least once
|
||||||
} while (getGunTurnRemaining() != 0);
|
} while (getGunTurnRemaining());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bullet fire(double power) {
|
public Bullet fire(double power) {
|
||||||
|
@ -475,7 +475,7 @@ public class BasicRobotProxy extends HostingRobotProxy implements IBasicRobotPee
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void setMoveImpl(double distance) {
|
protected final void setMoveImpl(double distance) {
|
||||||
if (getEnergyImpl() == 0) {
|
if (!getEnergyImpl()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
commands.setDistanceRemaining(distance);
|
commands.setDistanceRemaining(distance);
|
||||||
|
@ -487,7 +487,7 @@ public class BasicRobotProxy extends HostingRobotProxy implements IBasicRobotPee
|
||||||
println("SYSTEM: You cannot call fire(NaN)");
|
println("SYSTEM: You cannot call fire(NaN)");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (getGunHeatImpl() > 0 || getEnergyImpl() == 0) {
|
if (getGunHeatImpl() > 0 || !getEnergyImpl()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ abstract class HostingRobotProxy implements IHostingRobotProxy, IHostedThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void println(Throwable ex) {
|
private void println(Throwable ex) {
|
||||||
ex.printStackTrace(out);
|
LOGGER.log("context", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RobotStatics getStatics() {
|
public RobotStatics getStatics() {
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class JuniorRobotProxy extends BasicRobotProxy implements IJuniorRobotPee
|
||||||
}
|
}
|
||||||
|
|
||||||
public void turnAndMove(double distance, double radians) {
|
public void turnAndMove(double distance, double radians) {
|
||||||
if (distance == 0) {
|
if (!distance) {
|
||||||
turnBody(radians);
|
turnBody(radians);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class ThreadManager implements IThreadManager {
|
||||||
return false;
|
return false;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
syserr.println("Exception checking safe thread: ");
|
syserr.println("Exception checking safe thread: ");
|
||||||
e.printStackTrace(syserr);
|
LOGGER.log("context", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class AutoExtract implements ActionListener {
|
||||||
try {
|
try {
|
||||||
d = Double.parseDouble(s);
|
d = Double.parseDouble(s);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
e.printStackTrace(System.err);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
|
@ -98,14 +98,14 @@ public class AutoExtract implements ActionListener {
|
||||||
try {
|
try {
|
||||||
br.close();
|
br.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isr != null) {
|
if (isr != null) {
|
||||||
try {
|
try {
|
||||||
isr.close();
|
isr.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ public class AutoExtract implements ActionListener {
|
||||||
try {
|
try {
|
||||||
jarIS.close();
|
jarIS.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -546,9 +546,9 @@ public class AutoExtract implements ActionListener {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(System.err);
|
LOGGER.log("context", e);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace(System.err);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -604,10 +604,10 @@ public class AutoExtract implements ActionListener {
|
||||||
System.err.println("Could not create association(s)");
|
System.err.println("Could not create association(s)");
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
if (!file.delete()) {
|
if (!file.delete()) {
|
||||||
|
@ -663,7 +663,7 @@ public class AutoExtract implements ActionListener {
|
||||||
private static String getWindowsCmd() {
|
private static String getWindowsCmd() {
|
||||||
String os = System.getProperty("os.name");
|
String os = System.getProperty("os.name");
|
||||||
|
|
||||||
return ((os.equals("Windows 95") || os.equals("Windows 95") || os.equals("Windows ME"))
|
return ((os.equals("Windows 95") || os.equals("Windows ME"))
|
||||||
? "command.com"
|
? "command.com"
|
||||||
: "cmd.exe")
|
: "cmd.exe")
|
||||||
+ " /C ";
|
+ " /C ";
|
||||||
|
|
|
@ -59,8 +59,6 @@ class Repository implements IRepository {
|
||||||
ObjectOutputStream oos = null;
|
ObjectOutputStream oos = null;
|
||||||
try {
|
try {
|
||||||
oos = new ObjectOutputStream(out);
|
oos = new ObjectOutputStream(out);
|
||||||
oos.writeObject(uniqueRoots);
|
|
||||||
oos.writeObject(uniqueItems);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.logError("Can't save robot database", e);
|
Logger.logError("Can't save robot database", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -55,10 +55,6 @@ public abstract class RepositoryItem implements IRepositoryItem, Serializable {
|
||||||
isValid = valid;
|
isValid = valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return 31 + ((itemUrl == null) ? 0 : itemUrl.hashCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
@ -72,7 +68,6 @@ public abstract class RepositoryItem implements IRepositoryItem, Serializable {
|
||||||
if (itemUrl == null && other.itemUrl != null) {
|
if (itemUrl == null && other.itemUrl != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (itemUrl != null)
|
|
||||||
return itemUrl.equals(other.itemUrl);
|
return itemUrl.equals(other.itemUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class JarHandler extends RootHandler {
|
||||||
try {
|
try {
|
||||||
key = "jar:" + jar.toURI().toURL().toString() + "!/";
|
key = "jar:" + jar.toURI().toURL().toString() + "!/";
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IRepositoryRoot root = repository.getRoots().get(key);
|
IRepositoryRoot root = repository.getRoots().get(key);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class BattlesRunner {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize() {
|
private static void initialize() {
|
||||||
if (engine == null) {
|
if (engine == null) {
|
||||||
engine = new RobocodeEngine();
|
engine = new RobocodeEngine();
|
||||||
engine.addBattleListener(new BattleObserver());
|
engine.addBattleListener(new BattleObserver());
|
||||||
|
@ -228,7 +228,7 @@ public class BattlesRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBattleCompleted(final BattleCompletedEvent event) {
|
public static void onBattleCompleted(final BattleCompletedEvent event) {
|
||||||
lastResults = RobotResults.convertResults(event.getSortedResults());
|
lastResults = RobotResults.convertResults(event.getSortedResults());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,25 +100,25 @@ public class BotsDownload {
|
||||||
// delete previous files
|
// delete previous files
|
||||||
if (generalbotsfile.length() != 0) {
|
if (generalbotsfile.length() != 0) {
|
||||||
file = new File(generalbotsfile);
|
file = new File(generalbotsfile);
|
||||||
if (file.exists() && !file.delete()) {
|
if (file.exists() &&&& !file.delete()) {
|
||||||
Logger.logError("Can't delete file: " + file);
|
Logger.logError("Can't delete file: " + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (minibotsfile.length() != 0) {
|
if (minibotsfile.length() != 0) {
|
||||||
file = new File(minibotsfile);
|
file = new File(minibotsfile);
|
||||||
if (file.exists() && !file.delete()) {
|
if (file.exists() &&&& !file.delete()) {
|
||||||
Logger.logError("Can't delete file: " + file);
|
Logger.logError("Can't delete file: " + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (microbotsfile.length() != 0) {
|
if (microbotsfile.length() != 0) {
|
||||||
file = new File(microbotsfile);
|
file = new File(microbotsfile);
|
||||||
if (file.exists() && !file.delete()) {
|
if (file.exists() &&&& !file.delete()) {
|
||||||
Logger.logError("Can't delete file: " + file);
|
Logger.logError("Can't delete file: " + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nanobotsfile.length() != 0) {
|
if (nanobotsfile.length() != 0) {
|
||||||
file = new File(nanobotsfile);
|
file = new File(nanobotsfile);
|
||||||
if (file.exists() && !file.delete()) {
|
if (file.exists() &&&& !file.delete()) {
|
||||||
Logger.logError("Can't delete file: " + file);
|
Logger.logError("Can't delete file: " + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,17 +128,17 @@ public class BotsDownload {
|
||||||
}
|
}
|
||||||
boolean downloaded = true;
|
boolean downloaded = true;
|
||||||
|
|
||||||
if (generalBots.length() != 0 && generalbotsfile.length() != 0) {
|
if (generalBots.length() != 0 &&&& generalbotsfile.length() != 0) {
|
||||||
downloaded = downloadRatingsFile(generalBots, generalbotsfile) & downloaded;
|
downloaded = downloadRatingsFile(generalBots, generalbotsfile) && downloaded;
|
||||||
}
|
}
|
||||||
if (miniBots.length() != 0 && minibotsfile.length() != 0) {
|
if (miniBots.length() != 0 &&&& minibotsfile.length() != 0) {
|
||||||
downloaded = downloadRatingsFile(miniBots, minibotsfile) & downloaded;
|
downloaded = downloadRatingsFile(miniBots, minibotsfile) && downloaded;
|
||||||
}
|
}
|
||||||
if (microBots.length() != 0 && microbotsfile.length() != 0) {
|
if (microBots.length() != 0 &&&& microbotsfile.length() != 0) {
|
||||||
downloaded = downloadRatingsFile(microBots, microbotsfile) & downloaded;
|
downloaded = downloadRatingsFile(microBots, microbotsfile) && downloaded;
|
||||||
}
|
}
|
||||||
if (nanoBots.length() != 0 && nanobotsfile.length() != 0) {
|
if (nanoBots.length() != 0 &&&& nanobotsfile.length() != 0) {
|
||||||
downloaded = downloadRatingsFile(nanoBots, nanobotsfile) & downloaded;
|
downloaded = downloadRatingsFile(nanoBots, nanobotsfile) && downloaded;
|
||||||
}
|
}
|
||||||
return downloaded;
|
return downloaded;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ public class BotsDownload {
|
||||||
|
|
||||||
final File dir = new File(participantsfile).getParentFile();
|
final File dir = new File(participantsfile).getParentFile();
|
||||||
|
|
||||||
if (!dir.exists() && !dir.mkdirs()) {
|
if (!dir.exists() &&&& !dir.mkdirs()) {
|
||||||
Logger.logError("Can't create directory: " + dir);
|
Logger.logError("Can't create directory: " + dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,10 +332,10 @@ public class BotsDownload {
|
||||||
String sessionId = null;
|
String sessionId = null;
|
||||||
|
|
||||||
if (id.indexOf("://") == -1) {
|
if (id.indexOf("://") == -1) {
|
||||||
url = "http://robocoderepository.com/Controller.jsp?submitAction=downloadClass&id=" + id;
|
url = "http://robocoderepository.com/Controller.jsp?submitAction=downloadClass&&id=" + id;
|
||||||
|
|
||||||
sessionId = FileTransfer.getSessionId(
|
sessionId = FileTransfer.getSessionId(
|
||||||
"http://robocoderepository.com/BotSearch.jsp?botName=''&authorName=''&uploadDate=");
|
"http://robocoderepository.com/BotSearch.jsp?botName=''&&authorName=''&&uploadDate=");
|
||||||
} else {
|
} else {
|
||||||
url = id;
|
url = id;
|
||||||
}
|
}
|
||||||
|
@ -420,13 +420,13 @@ public class BotsDownload {
|
||||||
PrintStream outtxt = null;
|
PrintStream outtxt = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URL url = new URL(ratingsurl + "?version=1&game=" + competition);
|
URL url = new URL(ratingsurl + "?version=1&&game=" + competition);
|
||||||
|
|
||||||
HttpURLConnection conn = FileTransfer.connectToHttpInputConnection(url);
|
HttpURLConnection conn = FileTransfer.connectToHttpInputConnection(url);
|
||||||
|
|
||||||
final File dir = new File(file).getParentFile();
|
final File dir = new File(file).getParentFile();
|
||||||
|
|
||||||
if (!dir.exists() && !dir.mkdirs()) {
|
if (!dir.exists() &&&& !dir.mkdirs()) {
|
||||||
Logger.logError("Can't create directory: " + dir);
|
Logger.logError("Can't create directory: " + dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ public class BotsDownload {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String data = "version=1&game=" + game + "&name=" + bot.trim() + "&dummy=NA";
|
String data = "version=1&&game=" + game + "&&name=" + bot.trim() + "&&dummy=NA";
|
||||||
|
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
OutputStreamWriter outputStreamWriter = null;
|
OutputStreamWriter outputStreamWriter = null;
|
||||||
|
@ -614,7 +614,6 @@ public class BotsDownload {
|
||||||
if (robot.matches("[\\w\\.]+[ ][\\w\\.-]+")) {
|
if (robot.matches("[\\w\\.]+[ ][\\w\\.-]+")) {
|
||||||
if (link.startsWith("http")) {
|
if (link.startsWith("http")) {
|
||||||
try {
|
try {
|
||||||
new URL(link);
|
|
||||||
matches = true;
|
matches = true;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
matches = false;
|
matches = false;
|
||||||
|
|
|
@ -355,7 +355,7 @@ public class FileTransfer {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make sure the output stream is closed
|
// Make sure the output stream is closed
|
||||||
|
@ -363,7 +363,7 @@ public class FileTransfer {
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,14 +489,14 @@ public class FileTransfer {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,8 +181,8 @@ public class ResultsUpload {
|
||||||
|
|
||||||
String data = "game=" + game + commonData;
|
String data = "game=" + game + commonData;
|
||||||
|
|
||||||
if (matchtype.equals("GENERAL") || matchtype.equals("SERVER")) {
|
if (matchtype.equals("GENERAL") |||| matchtype.equals("SERVER")) {
|
||||||
errorsfound = errorsfound | senddata(game, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
errorsfound = errorsfound || senddata(game, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizesfile.length() != 0) { // upload also related competitions
|
if (sizesfile.length() != 0) { // upload also related competitions
|
||||||
|
@ -190,18 +190,18 @@ public class ResultsUpload {
|
||||||
&& size.checkCompetitorsForSize(first[0], second[0], 1500)) {
|
&& size.checkCompetitorsForSize(first[0], second[0], 1500)) {
|
||||||
data = "game=" + minibots + commonData;
|
data = "game=" + minibots + commonData;
|
||||||
errorsfound = errorsfound
|
errorsfound = errorsfound
|
||||||
| senddata(minibots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
|| senddata(minibots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||||
}
|
}
|
||||||
if (microbots.length() != 0 && !matchtype.equals("NANO")
|
if (microbots.length() != 0 && !matchtype.equals("NANO")
|
||||||
&& size.checkCompetitorsForSize(first[0], second[0], 750)) {
|
&& size.checkCompetitorsForSize(first[0], second[0], 750)) {
|
||||||
data = "game=" + microbots + commonData;
|
data = "game=" + microbots + commonData;
|
||||||
errorsfound = errorsfound
|
errorsfound = errorsfound
|
||||||
| senddata(microbots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
|| senddata(microbots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||||
}
|
}
|
||||||
if (nanobots.length() != 0 && size.checkCompetitorsForSize(first[0], second[0], 250)) {
|
if (nanobots.length() != 0 && size.checkCompetitorsForSize(first[0], second[0], 250)) {
|
||||||
data = "game=" + nanobots + commonData;
|
data = "game=" + nanobots + commonData;
|
||||||
errorsfound = errorsfound
|
errorsfound = errorsfound
|
||||||
| senddata(nanobots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
|| senddata(nanobots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public final class PropertiesUtil {
|
||||||
try {
|
try {
|
||||||
fis.close();
|
fis.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public final class PropertiesUtil {
|
||||||
try {
|
try {
|
||||||
fos.close();
|
fos.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class Corners extends Robot {
|
||||||
/**
|
/**
|
||||||
* onDeath: We died. Decide whether to try a different corner next game.
|
* onDeath: We died. Decide whether to try a different corner next game.
|
||||||
*/
|
*/
|
||||||
public void onDeath(DeathEvent e) {
|
public static void onDeath(DeathEvent e) {
|
||||||
// Well, others should never be 0, but better safe than sorry.
|
// Well, others should never be 0, but better safe than sorry.
|
||||||
if (others == 0) {
|
if (others == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.io.PrintStream;
|
||||||
public class SittingDuck extends AdvancedRobot {
|
public class SittingDuck extends AdvancedRobot {
|
||||||
static boolean incrementedBattles = false;
|
static boolean incrementedBattles = false;
|
||||||
|
|
||||||
public void run() {
|
public static void run() {
|
||||||
setBodyColor(Color.yellow);
|
setBodyColor(Color.yellow);
|
||||||
setGunColor(Color.yellow);
|
setGunColor(Color.yellow);
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class SittingDuck extends AdvancedRobot {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
out.println("IOException trying to write: ");
|
out.println("IOException trying to write: ");
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (w != null) {
|
if (w != null) {
|
||||||
w.close();
|
w.close();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class TrackFire extends Robot {
|
||||||
// Generates another scan event if we see a robot.
|
// Generates another scan event if we see a robot.
|
||||||
// We only need to call this if the gun (and therefore radar)
|
// We only need to call this if the gun (and therefore radar)
|
||||||
// are not turning. Otherwise, scan is called automatically.
|
// are not turning. Otherwise, scan is called automatically.
|
||||||
if (bearingFromGun == 0) {
|
if (bearingFromGun) {
|
||||||
scan();
|
scan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class MyFirstLeader extends TeamRobot {
|
||||||
broadcastMessage(new Point(enemyX, enemyY));
|
broadcastMessage(new Point(enemyX, enemyY));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
out.println("Unable to send order: ");
|
out.println("Unable to send order: ");
|
||||||
ex.printStackTrace(out);
|
LOGGER.log("context", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class SoundManager implements ISoundManager {
|
||||||
for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
|
for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
|
||||||
Mixer m = AudioSystem.getMixer(mi);
|
Mixer m = AudioSystem.getMixer(mi);
|
||||||
|
|
||||||
if (m.getClass().getSimpleName().equals(mixerClassName)) {
|
if (mixerClassName instanceof m) {
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
m.close();
|
m.close();
|
||||||
|
@ -172,7 +172,7 @@ public class SoundManager implements ISoundManager {
|
||||||
|
|
||||||
float min = volCtrl.getMinimum() / 4;
|
float min = volCtrl.getMinimum() / 4;
|
||||||
|
|
||||||
if (volume != 1) {
|
if (volume) {
|
||||||
volCtrl.setValue(min * (1 - volume));
|
volCtrl.setValue(min * (1 - volume));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class AwtAttack extends AdvancedRobot {
|
||||||
javax.swing.SwingUtilities.invokeLater(doHack);
|
javax.swing.SwingUtilities.invokeLater(doHack);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swalow security exception
|
// swalow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@ public class AwtAttack extends AdvancedRobot {
|
||||||
fs.close();
|
fs.close();
|
||||||
out.println("Hacked!!!");
|
out.println("Hacked!!!");
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swalow security exception
|
// swalow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot {
|
||||||
javax.swing.SwingUtilities.invokeLater(doHack);
|
javax.swing.SwingUtilities.invokeLater(doHack);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swallow security exception
|
// swallow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,12 +57,12 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot {
|
||||||
fs.close();
|
fs.close();
|
||||||
out.println("Hacked!!!");
|
out.println("Hacked!!!");
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swallow security exception
|
// swallow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ConstructorHttpAttack extends AdvancedRobot {
|
||||||
is.read();
|
is.read();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ConstructorReflectionAttack extends robocode.AdvancedRobot {
|
||||||
|
|
||||||
PrintStream ps = new PrintStream(baos);
|
PrintStream ps = new PrintStream(baos);
|
||||||
|
|
||||||
e.printStackTrace(ps);
|
LOGGER.log("context", e);
|
||||||
ps.flush();
|
ps.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ConstructorSocketAttack extends AdvancedRobot {
|
||||||
|
|
||||||
PrintStream ps = new PrintStream(baos);
|
PrintStream ps = new PrintStream(baos);
|
||||||
|
|
||||||
e.printStackTrace(ps);
|
LOGGER.log("context", e);
|
||||||
ps.flush();
|
ps.flush();
|
||||||
} finally {
|
} finally {
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
|
||||||
t.start();
|
t.start();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swallow security exception
|
// swallow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
|
||||||
t.start();
|
t.start();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swallow security exception
|
// swallow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
|
||||||
runAttack2();
|
runAttack2();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.wait();
|
|
||||||
} catch (InterruptedException e) {}
|
} catch (InterruptedException e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,12 @@ public class FileAttack extends AdvancedRobot {
|
||||||
System.out.print(fs.read());
|
System.out.print(fs.read());
|
||||||
fs.close();
|
fs.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swalow security exception
|
// swalow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,12 +69,12 @@ public class FileAttack extends AdvancedRobot {
|
||||||
fs.write(0xD0);
|
fs.write(0xD0);
|
||||||
fs.close();
|
fs.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swalow security exception
|
// swalow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class FileOutputStreamAttack extends AdvancedRobot {
|
||||||
fis = new FileOutputStream(file);
|
fis = new FileOutputStream(file);
|
||||||
fis.write(1);
|
fis.write(1);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (fis != null) {
|
if (fis != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -39,13 +39,13 @@ public class FileWriteSize extends AdvancedRobot {
|
||||||
rfos.write(buf);
|
rfos.write(buf);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (rfos != null) {
|
if (rfos != null) {
|
||||||
try {
|
try {
|
||||||
rfos.close();
|
rfos.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class HttpAttack extends AdvancedRobot {
|
||||||
is.read();
|
is.read();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class IncludeNamespaceAttack extends AdvancedRobot {
|
||||||
HiddenAccess.createRules(10, 10, 10, 10, 1, false, 100);
|
HiddenAccess.createRules(10, 10, 10, 10, 1, false, 100);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// Swallow security exception
|
// Swallow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ReflectionAttack extends robocode.AdvancedRobot {
|
||||||
method.invoke(obj, new Object[] { "Hello World" });
|
method.invoke(obj, new Object[] { "Hello World" });
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,14 +66,14 @@ public class SkipTurns extends AdvancedRobot {
|
||||||
|
|
||||||
synchronized (w) {
|
synchronized (w) {
|
||||||
try {
|
try {
|
||||||
if (skipped > 3) {
|
while (skipped > 3) {
|
||||||
w.wait(3000);
|
w.wait(3000);
|
||||||
} else {
|
} else {
|
||||||
w.wait(130);
|
w.wait(130);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// eat interrupt
|
// eat interrupt
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class SocketAttack extends AdvancedRobot {
|
||||||
os.write(1);
|
os.write(1);
|
||||||
is.read();
|
is.read();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ThreadAttack extends AdvancedRobot {
|
||||||
t.start();
|
t.start();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swallow security exception
|
// swallow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class ThreadAttack extends AdvancedRobot {
|
||||||
t.start();
|
t.start();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// swallow security exception
|
// swallow security exception
|
||||||
e.printStackTrace(out);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class ThreadAttack extends AdvancedRobot {
|
||||||
runAttack2();
|
runAttack2();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.wait();
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
out.println("Interrupted id:" + id);
|
out.println("Interrupted id:" + id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class ThreadGroupAttack extends Robot {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
} catch (RuntimeException t) {
|
} catch (RuntimeException t) {
|
||||||
t.printStackTrace(out);
|
LOGGER.log("context", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class WatchBullets extends AdvancedRobot {
|
||||||
// Generates another scan event if we see a robot.
|
// Generates another scan event if we see a robot.
|
||||||
// We only need to call this if the gun (and therefore radar)
|
// We only need to call this if the gun (and therefore radar)
|
||||||
// are not turning. Otherwise, scan is called automatically.
|
// are not turning. Otherwise, scan is called automatically.
|
||||||
if (bearingFromGun == 0) {
|
if (!bearingFromGun) {
|
||||||
scan();
|
scan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class Assert extends org.junit.Assert {
|
||||||
try {
|
try {
|
||||||
assertNear(v1, v2);
|
assertNear(v1, v2);
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
ex.printStackTrace(System.err);
|
LOGGER.log("context", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class Assert extends org.junit.Assert {
|
||||||
try {
|
try {
|
||||||
org.junit.Assert.assertThat(t, tMatcher);
|
org.junit.Assert.assertThat(t, tMatcher);
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
ex.printStackTrace(System.err);
|
LOGGER.log("context", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ public abstract class RobocodeTestBed extends BattleAdaptor {
|
||||||
protected static int messages = 0;
|
protected static int messages = 0;
|
||||||
protected static String robotsPath;
|
protected static String robotsPath;
|
||||||
|
|
||||||
public static boolean isDumpingPositions = false;
|
public static final boolean isDumpingPositions = false;
|
||||||
public static boolean isDumpingTurns = false;
|
public static final boolean isDumpingTurns = false;
|
||||||
public static boolean isDumpingOutput = true;
|
public static final boolean isDumpingOutput = true;
|
||||||
public static boolean isDumpingErrors = true;
|
public static final boolean isDumpingErrors = true;
|
||||||
public static boolean isDumpingMessages = true;
|
public static final boolean isDumpingMessages = true;
|
||||||
public static boolean hasJavaNetURLPermission = isClassAvailable("java.net.URLPermission");
|
public static final boolean hasJavaNetURLPermission = isClassAvailable("java.net.URLPermission");
|
||||||
|
|
||||||
private static boolean isClassAvailable(String name) {
|
private static boolean isClassAvailable(String name) {
|
||||||
try {
|
try {
|
||||||
|
@ -65,7 +65,7 @@ public abstract class RobocodeTestBed extends BattleAdaptor {
|
||||||
throw new Error("Unknown directory: " + currentDirAbsolutePath);
|
throw new Error("Unknown directory: " + currentDirAbsolutePath);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(Logger.realErr);
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
System.setProperty("ROBOTPATH", robotsPath + "/target/classes");
|
System.setProperty("ROBOTPATH", robotsPath + "/target/classes");
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public abstract class RobocodeTestBed extends BattleAdaptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public static void setup() {
|
||||||
engine.addBattleListener(this);
|
engine.addBattleListener(this);
|
||||||
if (isDeterministic()) {
|
if (isDeterministic()) {
|
||||||
RandomFactory.resetDeterministic(0);
|
RandomFactory.resetDeterministic(0);
|
||||||
|
|
|
@ -56,9 +56,9 @@ public class TestAcceleration extends RobocodeTestBed {
|
||||||
Assert.assertNear(1, caveat2.getVelocity());
|
Assert.assertNear(1, caveat2.getVelocity());
|
||||||
Assert.assertNear(1, caveat3.getVelocity());
|
Assert.assertNear(1, caveat3.getVelocity());
|
||||||
|
|
||||||
Assert.assertNear(1 - 1, distance(0, caveat1));
|
Assert.assertNear(0, distance(0, caveat1));
|
||||||
Assert.assertNear(1 - 1, distance(1, caveat2));
|
Assert.assertNear(0, distance(1, caveat2));
|
||||||
Assert.assertNear(1 - 1, distance(2, caveat3));
|
Assert.assertNear(0, distance(2, caveat3));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -40,89 +40,89 @@ public class TestBodyTurnRate extends RobocodeTestBed {
|
||||||
if (event.getTurnSnapshot().getTurn() == 60) {
|
if (event.getTurnSnapshot().getTurn() == 60) {
|
||||||
final String out = buf.toString();
|
final String out = buf.toString();
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("1: 0.0, -10.0") | out.contains("1: 0.0, -9.9999999999"));
|
Assert.assertTrue(out.contains("1: 0.0, -10.0") || out.contains("1: 0.0, -9.9999999999"));
|
||||||
Assert.assertTrue(out.contains("2: 1.0, -9.25") | out.contains("2: 1.0, -9.2499999999"));
|
Assert.assertTrue(out.contains("2: 1.0, -9.25") || out.contains("2: 1.0, -9.2499999999"));
|
||||||
Assert.assertTrue(out.contains("3: 2.0, -8.5") | out.contains("3: 2.0, -8.4999999999"));
|
Assert.assertTrue(out.contains("3: 2.0, -8.5") || out.contains("3: 2.0, -8.4999999999"));
|
||||||
Assert.assertTrue(out.contains("4: 3.0, -7.75") | out.contains("4: 3.0, -7.7499999999"));
|
Assert.assertTrue(out.contains("4: 3.0, -7.75") || out.contains("4: 3.0, -7.7499999999"));
|
||||||
Assert.assertTrue(out.contains("5: 4.0, -7.0") | out.contains("5: 4.0, -6.9999999999"));
|
Assert.assertTrue(out.contains("5: 4.0, -7.0") || out.contains("5: 4.0, -6.9999999999"));
|
||||||
Assert.assertTrue(out.contains("6: 5.0, -6.25") | out.contains("6: 5.0, -6.2499999999"));
|
Assert.assertTrue(out.contains("6: 5.0, -6.25") || out.contains("6: 5.0, -6.2499999999"));
|
||||||
Assert.assertTrue(out.contains("7: 6.0, -5.5") | out.contains("7: 6.0, -5.4999999999"));
|
Assert.assertTrue(out.contains("7: 6.0, -5.5") || out.contains("7: 6.0, -5.4999999999"));
|
||||||
Assert.assertTrue(out.contains("8: 7.0, -4.75") | out.contains("8: 7.0, -4.7499999999"));
|
Assert.assertTrue(out.contains("8: 7.0, -4.75") || out.contains("8: 7.0, -4.7499999999"));
|
||||||
Assert.assertTrue(out.contains("9: 8.0, -4.0") | out.contains("9: 8.0, -3.9999999999"));
|
Assert.assertTrue(out.contains("9: 8.0, -4.0") || out.contains("9: 8.0, -3.9999999999"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("10: 8.0, 0.0") | out.contains("10: 8.0, -0.0"));
|
Assert.assertTrue(out.contains("10: 8.0, 0.0") || out.contains("10: 8.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("11: 6.0, 0.0") | out.contains("11: 6.0, -0.0"));
|
Assert.assertTrue(out.contains("11: 6.0, 0.0") || out.contains("11: 6.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("12: 4.0, 0.0") | out.contains("12: 4.0, -0.0"));
|
Assert.assertTrue(out.contains("12: 4.0, 0.0") || out.contains("12: 4.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("13: 2.0, 0.0") | out.contains("13: 2.0, -0.0"));
|
Assert.assertTrue(out.contains("13: 2.0, 0.0") || out.contains("13: 2.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("14: 0.0, 0.0") | out.contains("14: 0.0, -0.0") | out.contains("14: -0.0, 0.0")
|
out.contains("14: 0.0, 0.0") || out.contains("14: 0.0, -0.0") || out.contains("14: -0.0, 0.0")
|
||||||
| out.contains("14: -0.0, -0.0"));
|
|| out.contains("14: -0.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("15: 0.0, 0.0") | out.contains("15: 0.0, -0.0") | out.contains("15: -0.0, 0.0")
|
out.contains("15: 0.0, 0.0") || out.contains("15: 0.0, -0.0") || out.contains("15: -0.0, 0.0")
|
||||||
| out.contains("15: -0.0, -0.0"));
|
|| out.contains("15: -0.0, -0.0"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("16: 0.0, 10.0") | out.contains("16: 0.0, 9.9999999999"));
|
Assert.assertTrue(out.contains("16: 0.0, 10.0") || out.contains("16: 0.0, 9.9999999999"));
|
||||||
Assert.assertTrue(out.contains("17: 1.0, 9.25") | out.contains("17: 1.0, 9.2499999999"));
|
Assert.assertTrue(out.contains("17: 1.0, 9.25") || out.contains("17: 1.0, 9.2499999999"));
|
||||||
Assert.assertTrue(out.contains("18: 2.0, 8.5") | out.contains("18: 2.0, 8.4999999999"));
|
Assert.assertTrue(out.contains("18: 2.0, 8.5") || out.contains("18: 2.0, 8.4999999999"));
|
||||||
Assert.assertTrue(out.contains("19: 3.0, 7.75") | out.contains("19: 3.0, 7.7499999999"));
|
Assert.assertTrue(out.contains("19: 3.0, 7.75") || out.contains("19: 3.0, 7.7499999999"));
|
||||||
Assert.assertTrue(out.contains("20: 4.0, 7.0") | out.contains("20: 4.0, 6.9999999999"));
|
Assert.assertTrue(out.contains("20: 4.0, 7.0") || out.contains("20: 4.0, 6.9999999999"));
|
||||||
Assert.assertTrue(out.contains("21: 5.0, 6.25") | out.contains("21: 5.0, 6.2499999999"));
|
Assert.assertTrue(out.contains("21: 5.0, 6.25") || out.contains("21: 5.0, 6.2499999999"));
|
||||||
Assert.assertTrue(out.contains("22: 6.0, 5.5") | out.contains("22: 6.0, 5.4999999999"));
|
Assert.assertTrue(out.contains("22: 6.0, 5.5") || out.contains("22: 6.0, 5.4999999999"));
|
||||||
Assert.assertTrue(out.contains("23: 7.0, 4.75") | out.contains("23: 7.0, 4.7499999999"));
|
Assert.assertTrue(out.contains("23: 7.0, 4.75") || out.contains("23: 7.0, 4.7499999999"));
|
||||||
Assert.assertTrue(out.contains("24: 8.0, 4.0") | out.contains("24: 8.0, 3.9999999999"));
|
Assert.assertTrue(out.contains("24: 8.0, 4.0") || out.contains("24: 8.0, 3.9999999999"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("25: 8.0, 0.0") | out.contains("25: 8.0, -0.0"));
|
Assert.assertTrue(out.contains("25: 8.0, 0.0") || out.contains("25: 8.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("26: 6.0, 0.0") | out.contains("26: 6.0, -0.0"));
|
Assert.assertTrue(out.contains("26: 6.0, 0.0") || out.contains("26: 6.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("27: 4.0, 0.0") | out.contains("27: 4.0, -0.0"));
|
Assert.assertTrue(out.contains("27: 4.0, 0.0") || out.contains("27: 4.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("28: 2.0, 0.0") | out.contains("28: 2.0, -0.0"));
|
Assert.assertTrue(out.contains("28: 2.0, 0.0") || out.contains("28: 2.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("29: 0.0, 0.0") | out.contains("29: 0.0, -0.0") | out.contains("29: -0.0, 0.0")
|
out.contains("29: 0.0, 0.0") || out.contains("29: 0.0, -0.0") || out.contains("29: -0.0, 0.0")
|
||||||
| out.contains("29: -0.0, -0.0"));
|
|| out.contains("29: -0.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("30: 0.0, 0.0") | out.contains("30: 0.0, -0.0") | out.contains("30: -0.0, 0.0")
|
out.contains("30: 0.0, 0.0") || out.contains("30: 0.0, -0.0") || out.contains("30: -0.0, 0.0")
|
||||||
| out.contains("30: -0.0, -0.0"));
|
|| out.contains("30: -0.0, -0.0"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("31: 0.0, 10.0") | out.contains("31: 0.0, 9.9999999999"));
|
Assert.assertTrue(out.contains("31: 0.0, 10.0") || out.contains("31: 0.0, 9.9999999999"));
|
||||||
Assert.assertTrue(out.contains("32: -1.0, 9.25") | out.contains("32: -1.0, 9.2499999999"));
|
Assert.assertTrue(out.contains("32: -1.0, 9.25") || out.contains("32: -1.0, 9.2499999999"));
|
||||||
Assert.assertTrue(out.contains("33: -2.0, 8.5") | out.contains("33: -2.0, 8.4999999999"));
|
Assert.assertTrue(out.contains("33: -2.0, 8.5") || out.contains("33: -2.0, 8.4999999999"));
|
||||||
Assert.assertTrue(out.contains("34: -3.0, 7.75") | out.contains("34: -3.0, 7.7499999999"));
|
Assert.assertTrue(out.contains("34: -3.0, 7.75") || out.contains("34: -3.0, 7.7499999999"));
|
||||||
Assert.assertTrue(out.contains("35: -4.0, 7.0") | out.contains("35: -4.0, 6.9999999999"));
|
Assert.assertTrue(out.contains("35: -4.0, 7.0") || out.contains("35: -4.0, 6.9999999999"));
|
||||||
Assert.assertTrue(out.contains("36: -5.0, 6.25") | out.contains("36: -5.0, 6.2499999999"));
|
Assert.assertTrue(out.contains("36: -5.0, 6.25") || out.contains("36: -5.0, 6.2499999999"));
|
||||||
Assert.assertTrue(out.contains("37: -6.0, 5.5") | out.contains("37: -6.0, 5.4999999999"));
|
Assert.assertTrue(out.contains("37: -6.0, 5.5") || out.contains("37: -6.0, 5.4999999999"));
|
||||||
Assert.assertTrue(out.contains("38: -7.0, 4.75") | out.contains("38: -7.0, 4.7499999999"));
|
Assert.assertTrue(out.contains("38: -7.0, 4.75") || out.contains("38: -7.0, 4.7499999999"));
|
||||||
Assert.assertTrue(out.contains("39: -8.0, 4.0") | out.contains("39: -8.0, 3.9999999999"));
|
Assert.assertTrue(out.contains("39: -8.0, 4.0") || out.contains("39: -8.0, 3.9999999999"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("40: -8.0, 0.0") | out.contains("40: -8.0, -0.0"));
|
Assert.assertTrue(out.contains("40: -8.0, 0.0") || out.contains("40: -8.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("41: -6.0, 0.0") | out.contains("41: -6.0, -0.0"));
|
Assert.assertTrue(out.contains("41: -6.0, 0.0") || out.contains("41: -6.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("42: -4.0, 0.0") | out.contains("42: -4.0, -0.0"));
|
Assert.assertTrue(out.contains("42: -4.0, 0.0") || out.contains("42: -4.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("43: -2.0, 0.0") | out.contains("43: -2.0, -0.0"));
|
Assert.assertTrue(out.contains("43: -2.0, 0.0") || out.contains("43: -2.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("44: -0.0, 0.0") | out.contains("44: -0.0, -0.0") | out.contains("44: 0.0, 0.0")
|
out.contains("44: -0.0, 0.0") || out.contains("44: -0.0, -0.0") || out.contains("44: 0.0, 0.0")
|
||||||
| out.contains("44: 0.0, -0.0"));
|
|| out.contains("44: 0.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("45: -0.0, 0.0") | out.contains("45: -0.0, -0.0") | out.contains("45: 0.0, 0.0")
|
out.contains("45: -0.0, 0.0") || out.contains("45: -0.0, -0.0") || out.contains("45: 0.0, 0.0")
|
||||||
| out.contains("45: 0.0, -0.0"));
|
|| out.contains("45: 0.0, -0.0"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("46: 0.0, -10.0") | out.contains("46: 0.0, -9.9999999999"));
|
Assert.assertTrue(out.contains("46: 0.0, -10.0") || out.contains("46: 0.0, -9.9999999999"));
|
||||||
Assert.assertTrue(out.contains("47: -1.0, -9.25") | out.contains("47: -1.0, -9.2499999999"));
|
Assert.assertTrue(out.contains("47: -1.0, -9.25") || out.contains("47: -1.0, -9.2499999999"));
|
||||||
Assert.assertTrue(out.contains("48: -2.0, -8.5") | out.contains("48: -2.0, -8.4999999999"));
|
Assert.assertTrue(out.contains("48: -2.0, -8.5") || out.contains("48: -2.0, -8.4999999999"));
|
||||||
Assert.assertTrue(out.contains("49: -3.0, -7.75") | out.contains("49: -3.0, -7.7499999999"));
|
Assert.assertTrue(out.contains("49: -3.0, -7.75") || out.contains("49: -3.0, -7.7499999999"));
|
||||||
Assert.assertTrue(out.contains("50: -4.0, -7.0") | out.contains("50: -4.0, -6.9999999999"));
|
Assert.assertTrue(out.contains("50: -4.0, -7.0") || out.contains("50: -4.0, -6.9999999999"));
|
||||||
Assert.assertTrue(out.contains("51: -5.0, -6.25") | out.contains("51: -5.0, -6.2499999999"));
|
Assert.assertTrue(out.contains("51: -5.0, -6.25") || out.contains("51: -5.0, -6.2499999999"));
|
||||||
Assert.assertTrue(out.contains("52: -6.0, -5.5") | out.contains("52: -6.0, -5.4999999999"));
|
Assert.assertTrue(out.contains("52: -6.0, -5.5") || out.contains("52: -6.0, -5.4999999999"));
|
||||||
Assert.assertTrue(out.contains("53: -7.0, -4.75") | out.contains("53: -7.0, -4.7499999999"));
|
Assert.assertTrue(out.contains("53: -7.0, -4.75") || out.contains("53: -7.0, -4.7499999999"));
|
||||||
Assert.assertTrue(out.contains("54: -8.0, -4.0") | out.contains("54: -8.0, -3.9999999999"));
|
Assert.assertTrue(out.contains("54: -8.0, -4.0") || out.contains("54: -8.0, -3.9999999999"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("55: -8.0, 0.0") | out.contains("55: -8.0, -0.0"));
|
Assert.assertTrue(out.contains("55: -8.0, 0.0") || out.contains("55: -8.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("56: -6.0, 0.0") | out.contains("56: -6.0, -0.0"));
|
Assert.assertTrue(out.contains("56: -6.0, 0.0") || out.contains("56: -6.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("57: -4.0, 0.0") | out.contains("57: -4.0, -0.0"));
|
Assert.assertTrue(out.contains("57: -4.0, 0.0") || out.contains("57: -4.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("58: -2.0, 0.0") | out.contains("58: -2.0, -0.0"));
|
Assert.assertTrue(out.contains("58: -2.0, 0.0") || out.contains("58: -2.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("59: -0.0, 0.0") | out.contains("59: -0.0, -0.0") | out.contains("59: 0.0, 0.0")
|
out.contains("59: -0.0, 0.0") || out.contains("59: -0.0, -0.0") || out.contains("59: 0.0, 0.0")
|
||||||
| out.contains("59: 0.0, -0.0"));
|
|| out.contains("59: 0.0, -0.0"));
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
out.contains("60: -0.0, 0.0") | out.contains("60: -0.0, -0.0") | out.contains("60: 0.0, 0.0")
|
out.contains("60: -0.0, 0.0") || out.contains("60: -0.0, -0.0") || out.contains("60: 0.0, 0.0")
|
||||||
| out.contains("60: 0.0, -0.0"));
|
|| out.contains("60: 0.0, -0.0"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,22 +40,22 @@ public class TestGunTurnRate extends RobocodeTestBed {
|
||||||
if (event.getTurnSnapshot().getTurn() == 16) {
|
if (event.getTurnSnapshot().getTurn() == 16) {
|
||||||
final String out = buf.toString();
|
final String out = buf.toString();
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("1: -20.0") | out.contains("1: -19.9999999999"));
|
Assert.assertTrue(out.contains("1: -20.0") || out.contains("1: -19.9999999999"));
|
||||||
Assert.assertTrue(out.contains("2: -20.0") | out.contains("2: -19.9999999999"));
|
Assert.assertTrue(out.contains("2: -20.0") || out.contains("2: -19.9999999999"));
|
||||||
Assert.assertTrue(out.contains("3: 20.0") | out.contains("3: 19.9999999999"));
|
Assert.assertTrue(out.contains("3: 20.0") || out.contains("3: 19.9999999999"));
|
||||||
Assert.assertTrue(out.contains("4: 20.0") | out.contains("4: 19.9999999999"));
|
Assert.assertTrue(out.contains("4: 20.0") || out.contains("4: 19.9999999999"));
|
||||||
Assert.assertTrue(out.contains("5: -25.0") | out.contains("5: -24.9999999999"));
|
Assert.assertTrue(out.contains("5: -25.0") || out.contains("5: -24.9999999999"));
|
||||||
Assert.assertTrue(out.contains("6: -25.0") | out.contains("6: -24.9999999999"));
|
Assert.assertTrue(out.contains("6: -25.0") || out.contains("6: -24.9999999999"));
|
||||||
Assert.assertTrue(out.contains("7: 25.0") | out.contains("7: 24.9999999999"));
|
Assert.assertTrue(out.contains("7: 25.0") || out.contains("7: 24.9999999999"));
|
||||||
Assert.assertTrue(out.contains("8: 25.0") | out.contains("8: 24.9999999999"));
|
Assert.assertTrue(out.contains("8: 25.0") || out.contains("8: 24.9999999999"));
|
||||||
Assert.assertTrue(out.contains("9: -30.0") | out.contains("9: -29.9999999999"));
|
Assert.assertTrue(out.contains("9: -30.0") || out.contains("9: -29.9999999999"));
|
||||||
Assert.assertTrue(out.contains("10: -30.0") | out.contains("10: -29.9999999999"));
|
Assert.assertTrue(out.contains("10: -30.0") || out.contains("10: -29.9999999999"));
|
||||||
Assert.assertTrue(out.contains("11: 30.0") | out.contains("11: 29.9999999999"));
|
Assert.assertTrue(out.contains("11: 30.0") || out.contains("11: 29.9999999999"));
|
||||||
Assert.assertTrue(out.contains("12: 30.0") | out.contains("12: 29.9999999999"));
|
Assert.assertTrue(out.contains("12: 30.0") || out.contains("12: 29.9999999999"));
|
||||||
Assert.assertTrue(out.contains("13: -10.0") | out.contains("13: -9.9999999999"));
|
Assert.assertTrue(out.contains("13: -10.0") || out.contains("13: -9.9999999999"));
|
||||||
Assert.assertTrue(out.contains("14: -10.0") | out.contains("14: -9.9999999999"));
|
Assert.assertTrue(out.contains("14: -10.0") || out.contains("14: -9.9999999999"));
|
||||||
Assert.assertTrue(out.contains("15: 10.0") | out.contains("15: 9.9999999999"));
|
Assert.assertTrue(out.contains("15: 10.0") || out.contains("15: 9.9999999999"));
|
||||||
Assert.assertTrue(out.contains("16: 10.0") | out.contains("16: 9.9999999999"));
|
Assert.assertTrue(out.contains("16: 10.0") || out.contains("16: 9.9999999999"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,33 +40,33 @@ public class TestMaxTurnRate extends RobocodeTestBed {
|
||||||
if (event.getTurnSnapshot().getTurn() == 26) {
|
if (event.getTurnSnapshot().getTurn() == 26) {
|
||||||
final String out = buf.toString();
|
final String out = buf.toString();
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("1: 0.0, 0.0") | out.contains("1: 0.0, -0.0"));
|
Assert.assertTrue(out.contains("1: 0.0, 0.0") || out.contains("1: 0.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("2: 0.0, -1.0") | out.contains("2: 0.0, -0.999999999"));
|
Assert.assertTrue(out.contains("2: 0.0, -1.0") || out.contains("2: 0.0, -0.999999999"));
|
||||||
Assert.assertTrue(out.contains("3: 0.0, -2.0") | out.contains("3: 0.0, -1.999999999"));
|
Assert.assertTrue(out.contains("3: 0.0, -2.0") || out.contains("3: 0.0, -1.999999999"));
|
||||||
Assert.assertTrue(out.contains("4: 0.0, -3.0") | out.contains("4: 0.0, -2.999999999"));
|
Assert.assertTrue(out.contains("4: 0.0, -3.0") || out.contains("4: 0.0, -2.999999999"));
|
||||||
Assert.assertTrue(out.contains("5: 0.0, -4.0") | out.contains("5: 0.0, -3.999999999"));
|
Assert.assertTrue(out.contains("5: 0.0, -4.0") || out.contains("5: 0.0, -3.999999999"));
|
||||||
Assert.assertTrue(out.contains("6: 0.0, -5.0") | out.contains("6: 0.0, -4.999999999"));
|
Assert.assertTrue(out.contains("6: 0.0, -5.0") || out.contains("6: 0.0, -4.999999999"));
|
||||||
Assert.assertTrue(out.contains("7: 0.0, -6.0") | out.contains("7: 0.0, -5.999999999"));
|
Assert.assertTrue(out.contains("7: 0.0, -6.0") || out.contains("7: 0.0, -5.999999999"));
|
||||||
Assert.assertTrue(out.contains("8: 0.0, -7.0") | out.contains("8: 0.0, -6.999999999"));
|
Assert.assertTrue(out.contains("8: 0.0, -7.0") || out.contains("8: 0.0, -6.999999999"));
|
||||||
Assert.assertTrue(out.contains("9: 0.0, -8.0") | out.contains("9: 0.0, -7.999999999"));
|
Assert.assertTrue(out.contains("9: 0.0, -8.0") || out.contains("9: 0.0, -7.999999999"));
|
||||||
Assert.assertTrue(out.contains("10: 0.0, -9.0") | out.contains("10: 0.0, -8.999999999"));
|
Assert.assertTrue(out.contains("10: 0.0, -9.0") || out.contains("10: 0.0, -8.999999999"));
|
||||||
Assert.assertTrue(out.contains("11: 0.0, -10.0") | out.contains("11: 0.0, -9.999999999"));
|
Assert.assertTrue(out.contains("11: 0.0, -10.0") || out.contains("11: 0.0, -9.999999999"));
|
||||||
Assert.assertTrue(out.contains("12: 0.0, -10.0") | out.contains("12: 0.0, -9.999999999"));
|
Assert.assertTrue(out.contains("12: 0.0, -10.0") || out.contains("12: 0.0, -9.999999999"));
|
||||||
Assert.assertTrue(out.contains("13: 0.0, -10.0") | out.contains("13: 0.0, -9.999999999"));
|
Assert.assertTrue(out.contains("13: 0.0, -10.0") || out.contains("13: 0.0, -9.999999999"));
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("14: 0.0, 0.0") | out.contains("14: 0.0, -0.0"));
|
Assert.assertTrue(out.contains("14: 0.0, 0.0") || out.contains("14: 0.0, -0.0"));
|
||||||
Assert.assertTrue(out.contains("15: 0.0, 1.0") | out.contains("15: 0.0, 0.999999999"));
|
Assert.assertTrue(out.contains("15: 0.0, 1.0") || out.contains("15: 0.0, 0.999999999"));
|
||||||
Assert.assertTrue(out.contains("16: 0.0, 2.0") | out.contains("16: 0.0, 1.999999999"));
|
Assert.assertTrue(out.contains("16: 0.0, 2.0") || out.contains("16: 0.0, 1.999999999"));
|
||||||
Assert.assertTrue(out.contains("17: 0.0, 3.0") | out.contains("17: 0.0, 2.999999999"));
|
Assert.assertTrue(out.contains("17: 0.0, 3.0") || out.contains("17: 0.0, 2.999999999"));
|
||||||
Assert.assertTrue(out.contains("18: 0.0, 4.0") | out.contains("18: 0.0, 3.999999999"));
|
Assert.assertTrue(out.contains("18: 0.0, 4.0") || out.contains("18: 0.0, 3.999999999"));
|
||||||
Assert.assertTrue(out.contains("19: 0.0, 5.0") | out.contains("19: 0.0, 4.999999999"));
|
Assert.assertTrue(out.contains("19: 0.0, 5.0") || out.contains("19: 0.0, 4.999999999"));
|
||||||
Assert.assertTrue(out.contains("20: 0.0, 6.0") | out.contains("20: 0.0, 5.999999999"));
|
Assert.assertTrue(out.contains("20: 0.0, 6.0") || out.contains("20: 0.0, 5.999999999"));
|
||||||
Assert.assertTrue(out.contains("21: 0.0, 7.0") | out.contains("21: 0.0, 6.999999999"));
|
Assert.assertTrue(out.contains("21: 0.0, 7.0") || out.contains("21: 0.0, 6.999999999"));
|
||||||
Assert.assertTrue(out.contains("22: 0.0, 8.0") | out.contains("22: 0.0, 7.999999999"));
|
Assert.assertTrue(out.contains("22: 0.0, 8.0") || out.contains("22: 0.0, 7.999999999"));
|
||||||
Assert.assertTrue(out.contains("23: 0.0, 9.0") | out.contains("23: 0.0, 8.999999999"));
|
Assert.assertTrue(out.contains("23: 0.0, 9.0") || out.contains("23: 0.0, 8.999999999"));
|
||||||
Assert.assertTrue(out.contains("24: 0.0, 10.0") | out.contains("24: 0.0, 9.999999999"));
|
Assert.assertTrue(out.contains("24: 0.0, 10.0") || out.contains("24: 0.0, 9.999999999"));
|
||||||
Assert.assertTrue(out.contains("25: 0.0, 10.0") | out.contains("25: 0.0, 9.999999999"));
|
Assert.assertTrue(out.contains("25: 0.0, 10.0") || out.contains("25: 0.0, 9.999999999"));
|
||||||
Assert.assertTrue(out.contains("26: 0.0, 10.0") | out.contains("26: 0.0, 9.999999999"));
|
Assert.assertTrue(out.contains("26: 0.0, 10.0") || out.contains("26: 0.0, 9.999999999"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,20 +40,20 @@ public class TestRadarTurnRateAndSetAdjust extends RobocodeTestBed {
|
||||||
if (event.getTurnSnapshot().getTurn() == 14) {
|
if (event.getTurnSnapshot().getTurn() == 14) {
|
||||||
final String out = buf.toString();
|
final String out = buf.toString();
|
||||||
|
|
||||||
Assert.assertTrue(out.contains("1: 45.0") | out.contains("1: 44.999999999"));
|
Assert.assertTrue(out.contains("1: 45.0") || out.contains("1: 44.999999999"));
|
||||||
Assert.assertTrue(out.contains("2: 65.0") | out.contains("2: 64.999999999"));
|
Assert.assertTrue(out.contains("2: 65.0") || out.contains("2: 64.999999999"));
|
||||||
Assert.assertTrue(out.contains("3: 75.0") | out.contains("3: 74.999999999"));
|
Assert.assertTrue(out.contains("3: 75.0") || out.contains("3: 74.999999999"));
|
||||||
Assert.assertTrue(out.contains("4: -15.0") | out.contains("4: -14.999999999"));
|
Assert.assertTrue(out.contains("4: -15.0") || out.contains("4: -14.999999999"));
|
||||||
Assert.assertTrue(out.contains("5: -55.0") | out.contains("5: -54.999999999"));
|
Assert.assertTrue(out.contains("5: -55.0") || out.contains("5: -54.999999999"));
|
||||||
Assert.assertTrue(out.contains("6: -75.0") | out.contains("6: -74.999999999"));
|
Assert.assertTrue(out.contains("6: -75.0") || out.contains("6: -74.999999999"));
|
||||||
Assert.assertTrue(out.contains("7: 32.0") | out.contains("7: 31.999999999"));
|
Assert.assertTrue(out.contains("7: 32.0") || out.contains("7: 31.999999999"));
|
||||||
Assert.assertTrue(out.contains("8: 17.0") | out.contains("8: 16.999999999"));
|
Assert.assertTrue(out.contains("8: 17.0") || out.contains("8: 16.999999999"));
|
||||||
Assert.assertTrue(out.contains("9: 35.0") | out.contains("9: 34.999999999"));
|
Assert.assertTrue(out.contains("9: 35.0") || out.contains("9: 34.999999999"));
|
||||||
Assert.assertTrue(out.contains("10: 3.0") | out.contains("10: 2.999999999"));
|
Assert.assertTrue(out.contains("10: 3.0") || out.contains("10: 2.999999999"));
|
||||||
Assert.assertTrue(out.contains("11: -21.0") | out.contains("11: -20.999999999"));
|
Assert.assertTrue(out.contains("11: -21.0") || out.contains("11: -20.999999999"));
|
||||||
Assert.assertTrue(out.contains("12: 75.0") | out.contains("12: 74.999999999"));
|
Assert.assertTrue(out.contains("12: 75.0") || out.contains("12: 74.999999999"));
|
||||||
Assert.assertTrue(out.contains("13: -75.0") | out.contains("13: -74.999999999"));
|
Assert.assertTrue(out.contains("13: -75.0") || out.contains("13: -74.999999999"));
|
||||||
Assert.assertTrue(out.contains("14: -15.0") | out.contains("14: -14.999999999"));
|
Assert.assertTrue(out.contains("14: -15.0") || out.contains("14: -14.999999999"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class CompilerPreferencesDialog extends JDialog {
|
||||||
private CompilerProperties compilerProperties;
|
private CompilerProperties compilerProperties;
|
||||||
private JButton okButton;
|
private JButton okButton;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private class EventHandler implements ActionListener {
|
private class EventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
|
@ -56,7 +56,8 @@ public class CompoundUndoManager extends UndoManagerWithActions {
|
||||||
String insertedText = event.getDocument().getText(event.getOffset(), event.getLength());
|
String insertedText = event.getDocument().getText(event.getOffset(), event.getLength());
|
||||||
isEndCompoundEdit = insertedText.contains("\n");
|
isEndCompoundEdit = insertedText.contains("\n");
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class EditorPane extends JTextPane {
|
||||||
|
|
||||||
private final CompoundUndoManager undoManager = new CompoundUndoManager();
|
private final CompoundUndoManager undoManager = new CompoundUndoManager();
|
||||||
|
|
||||||
private final TextTool textTool = new TextTool();
|
private final transient TextTool textTool = new TextTool();
|
||||||
|
|
||||||
private JViewport viewport;
|
private JViewport viewport;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class EditorPane extends JTextPane {
|
||||||
DefaultCaret caret = (DefaultCaret) getCaret();
|
DefaultCaret caret = (DefaultCaret) getCaret();
|
||||||
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
|
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
|
||||||
|
|
||||||
new LineNumberArea(this);
|
|
||||||
|
|
||||||
LineHighlighter.install(this);
|
LineHighlighter.install(this);
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ public class EditorPane extends JTextPane {
|
||||||
textTool.insertString(selectionStart, newText.toString());
|
textTool.insertString(selectionStart, newText.toString());
|
||||||
undoManager.markCompoundStart();
|
undoManager.markCompoundStart();
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the new selection
|
// Compute the new selection
|
||||||
|
@ -326,7 +326,7 @@ public class EditorPane extends JTextPane {
|
||||||
try {
|
try {
|
||||||
return getDocument().getText(start, end - start);
|
return getDocument().getText(start, end - start);
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ public class EditorPane extends JTextPane {
|
||||||
try {
|
try {
|
||||||
getDocument().insertString(offset, str, a);
|
getDocument().insertString(offset, str, a);
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ public class EditorPane extends JTextPane {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ public class EditorPane extends JTextPane {
|
||||||
try {
|
try {
|
||||||
getDocument().remove(offset, len);
|
getDocument().remove(offset, len);
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class EditorPanel extends JPanel {
|
||||||
rn++;
|
rn++;
|
||||||
}
|
}
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
return rn;
|
return rn;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ public class EditorPanel extends JPanel {
|
||||||
try {
|
try {
|
||||||
return pos - Utilities.getRowStart(editor, pos) + 1;
|
return pos - Utilities.getRowStart(editor, pos) + 1;
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class EditorThemeConfigDialog extends JDialog {
|
||||||
private ColorAndStyle annotationTextColorAndStyle;
|
private ColorAndStyle annotationTextColorAndStyle;
|
||||||
private ColorAndStyle commentTextColorAndStyle;
|
private ColorAndStyle commentTextColorAndStyle;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
public EditorThemeConfigDialog(JFrame owner) {
|
public EditorThemeConfigDialog(JFrame owner) {
|
||||||
super(owner, true);
|
super(owner, true);
|
||||||
|
|
|
@ -762,7 +762,7 @@ public class JavaDocument extends StyledDocument {
|
||||||
performSyntaxHighlighting(force);
|
performSyntaxHighlighting(force);
|
||||||
updateSyntaxHighlightingEDTidle = true;
|
updateSyntaxHighlightingEDTidle = true;
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -121,7 +121,7 @@ public final class LineHighlighter {
|
||||||
};
|
};
|
||||||
|
|
||||||
private static EditorThemePropertyChangeAdapter editorThemePropertyChangeListener = new EditorThemePropertyChangeAdapter() {
|
private static EditorThemePropertyChangeAdapter editorThemePropertyChangeListener = new EditorThemePropertyChangeAdapter() {
|
||||||
public void onHighlightedLineColorChanged(Color newColor) {
|
public void static onHighlightedLineColorChanged(Color newColor) {
|
||||||
if (!color.equals(newColor)) {
|
if (!color.equals(newColor)) {
|
||||||
color = newColor;
|
color = newColor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import net.sf.robocode.ui.editor.theme.EditorThemePropertyChangeAdapter;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class LineNumberArea extends JTextArea {
|
public class LineNumberArea extends JTextArea {
|
||||||
|
|
||||||
private final DocumentListener documentListener = new TextDocumentListener();
|
private final transient DocumentListener documentListener = new TextDocumentListener();
|
||||||
|
|
||||||
public LineNumberArea(JTextComponent textComponent) {
|
public LineNumberArea(JTextComponent textComponent) {
|
||||||
super("1");
|
super("1");
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class RobocodeEditor extends JFrame implements Runnable, IRobocodeEditor
|
||||||
private FindReplaceDialog findReplaceDialog;
|
private FindReplaceDialog findReplaceDialog;
|
||||||
private ReplaceAction replaceAction;
|
private ReplaceAction replaceAction;
|
||||||
|
|
||||||
final EventHandler eventHandler = new EventHandler();
|
final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
class EventHandler implements ComponentListener {
|
class EventHandler implements ComponentListener {
|
||||||
public void componentMoved(ComponentEvent e) {}
|
public void componentMoved(ComponentEvent e) {}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.awt.event.KeyEvent;
|
||||||
public class RobocodeEditorMenuBar extends JMenuBar {
|
public class RobocodeEditorMenuBar extends JMenuBar {
|
||||||
|
|
||||||
private final RobocodeEditor editor;
|
private final RobocodeEditor editor;
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private class EventHandler implements ActionListener {
|
private class EventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
|
@ -26,8 +26,8 @@ import javax.swing.undo.UndoManager;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class UndoManagerWithActions extends UndoManager {
|
public class UndoManagerWithActions extends UndoManager {
|
||||||
|
|
||||||
private Action undoAction = new UndoAction();
|
private transient Action undoAction = new UndoAction();
|
||||||
private Action redoAction = new RedoAction();
|
private transient Action redoAction = new RedoAction();
|
||||||
|
|
||||||
public UndoManagerWithActions() {
|
public UndoManagerWithActions() {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class BattleView extends Canvas {
|
||||||
private final int groundTileWidth = 64;
|
private final int groundTileWidth = 64;
|
||||||
private final int groundTileHeight = 64;
|
private final int groundTileHeight = 64;
|
||||||
|
|
||||||
private Image groundImage;
|
private transient Image groundImage;
|
||||||
|
|
||||||
// Draw option related things
|
// Draw option related things
|
||||||
private boolean drawRobotName;
|
private boolean drawRobotName;
|
||||||
|
@ -80,7 +80,7 @@ public class BattleView extends Canvas {
|
||||||
|
|
||||||
private int numBuffers = 2; // defaults to double buffering
|
private int numBuffers = 2; // defaults to double buffering
|
||||||
|
|
||||||
private RenderingHints renderingHints;
|
private transient RenderingHints renderingHints;
|
||||||
|
|
||||||
// Fonts and the like
|
// Fonts and the like
|
||||||
private Font smallFont;
|
private Font smallFont;
|
||||||
|
@ -90,7 +90,7 @@ public class BattleView extends Canvas {
|
||||||
private final ISettingsManager properties;
|
private final ISettingsManager properties;
|
||||||
private final IWindowManagerExt windowManager;
|
private final IWindowManagerExt windowManager;
|
||||||
|
|
||||||
private BufferStrategy bufferStrategy;
|
private transient BufferStrategy bufferStrategy;
|
||||||
|
|
||||||
private final GeneralPath robocodeTextPath = new RobocodeLogo().getRobocodeText();
|
private final GeneralPath robocodeTextPath = new RobocodeLogo().getRobocodeText();
|
||||||
|
|
||||||
|
@ -106,7 +106,6 @@ public class BattleView extends Canvas {
|
||||||
|
|
||||||
battleField = new BattleField(800, 600);
|
battleField = new BattleField(800, 600);
|
||||||
|
|
||||||
new BattleObserver(windowManager);
|
|
||||||
|
|
||||||
properties.addPropertyListener(new ISettingsListener() {
|
properties.addPropertyListener(new ISettingsListener() {
|
||||||
public void settingChanged(String property) {
|
public void settingChanged(String property) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import net.sf.robocode.io.FileUtil;
|
||||||
*/
|
*/
|
||||||
public class ScreenshotUtil {
|
public class ScreenshotUtil {
|
||||||
|
|
||||||
private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH.mm.ss.SSS");
|
private final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH.mm.ss.SSS");
|
||||||
|
|
||||||
public static void saveScreenshot(BufferedImage screenshot, String format, float compressionQuality) {
|
public static void saveScreenshot(BufferedImage screenshot, String format, float compressionQuality) {
|
||||||
FileImageOutputStream output = null;
|
FileImageOutputStream output = null;
|
||||||
|
@ -67,7 +67,7 @@ public class ScreenshotUtil {
|
||||||
|
|
||||||
writer.write(null, image, iwp);
|
writer.write(null, image, iwp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (writer != null) {
|
if (writer != null) {
|
||||||
writer.dispose();
|
writer.dispose();
|
||||||
|
@ -76,7 +76,7 @@ public class ScreenshotUtil {
|
||||||
try {
|
try {
|
||||||
output.close();
|
output.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class AvailableRobotsPanel extends JPanel {
|
public class AvailableRobotsPanel extends JPanel {
|
||||||
|
|
||||||
private final List<ItemWrapper> availableRobots = new CopyOnWriteArrayList<ItemWrapper>();
|
private final transient List<ItemWrapper> availableRobots = new CopyOnWriteArrayList<ItemWrapper>();
|
||||||
private List<IRobotSpecItem> robotList = new CopyOnWriteArrayList<IRobotSpecItem>();
|
private List<IRobotSpecItem> robotList = new CopyOnWriteArrayList<IRobotSpecItem>();
|
||||||
private final List<String> availablePackages = new CopyOnWriteArrayList<String>();
|
private final List<String> availablePackages = new CopyOnWriteArrayList<String>();
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class AvailableRobotsPanel extends JPanel {
|
||||||
|
|
||||||
private final String title;
|
private final String title;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
public AvailableRobotsPanel(JButton actionButton, String title, JList actionList,
|
public AvailableRobotsPanel(JButton actionButton, String title, JList actionList,
|
||||||
RobotSelectionPanel robotSelectionPanel) {
|
RobotSelectionPanel robotSelectionPanel) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.awt.event.ComponentListener;
|
||||||
public abstract class BaseScoreDialog extends JDialog {
|
public abstract class BaseScoreDialog extends JDialog {
|
||||||
protected final IWindowManagerExt windowManager;
|
protected final IWindowManagerExt windowManager;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
protected JPanel contentPane;
|
protected JPanel contentPane;
|
||||||
protected JScrollPane scrollPane;
|
protected JScrollPane scrollPane;
|
||||||
protected JTable table;
|
protected JTable table;
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.io.StringWriter;
|
||||||
public class BattleDialog extends JFrame {
|
public class BattleDialog extends JFrame {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final BattleObserver battleObserver = new BattleObserver();
|
private final transient BattleObserver battleObserver = new BattleObserver();
|
||||||
|
|
||||||
private ConsoleScrollPane consoleScrollPane;
|
private ConsoleScrollPane consoleScrollPane;
|
||||||
private ConsoleScrollPane turnSnapshotScrollPane;
|
private ConsoleScrollPane turnSnapshotScrollPane;
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class ConsoleDialog extends JDialog {
|
||||||
private JMenu editMenu;
|
private JMenu editMenu;
|
||||||
private JMenuItem editCopyMenuItem;
|
private JMenuItem editCopyMenuItem;
|
||||||
private JMenuBar consoleDialogMenuBar;
|
private JMenuBar consoleDialogMenuBar;
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private class EventHandler implements ActionListener {
|
private class EventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class MenuBar extends JMenuBar {
|
||||||
public void menuCanceled(MenuEvent e) {}
|
public void menuCanceled(MenuEvent e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final MenuBar.EventHandler eventHandler = new EventHandler();
|
public final transient MenuBar.EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private RobocodeFrame robocodeFrame;
|
private RobocodeFrame robocodeFrame;
|
||||||
private final ISettingsManager properties;
|
private final ISettingsManager properties;
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class NewBattleDialog extends JDialog implements WizardListener {
|
||||||
private final static int MAX_ROBOTS = 256; // 64;
|
private final static int MAX_ROBOTS = 256; // 64;
|
||||||
private final static int MIN_ROBOTS = 1;
|
private final static int MIN_ROBOTS = 1;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private ISettingsManager settingsManager;
|
private ISettingsManager settingsManager;
|
||||||
private BattleProperties battleProperties;
|
private BattleProperties battleProperties;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class NewBattleRulesTab extends JPanel {
|
||||||
private ISettingsManager settingsManager;
|
private ISettingsManager settingsManager;
|
||||||
private BattleProperties battleProperties;
|
private BattleProperties battleProperties;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private SizeButton[] predefinedSizeButtons = {
|
private SizeButton[] predefinedSizeButtons = {
|
||||||
new SizeButton(400, 400), new SizeButton(600, 400), new SizeButton(600, 600), new SizeButton(800, 600),
|
new SizeButton(400, 400), new SizeButton(600, 400), new SizeButton(600, 600), new SizeButton(800, 600),
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class RcSplashScreen extends JWindow {
|
||||||
private JLabel splashLabel;
|
private JLabel splashLabel;
|
||||||
private JPanel splashPanel;
|
private JPanel splashPanel;
|
||||||
private JPanel splashScreenContentPane;
|
private JPanel splashScreenContentPane;
|
||||||
private Image splashImage;
|
private transient Image splashImage;
|
||||||
private final String version;
|
private final String version;
|
||||||
|
|
||||||
private final transient WindowListener eventHandler = new WindowAdapter() {
|
private final transient WindowListener eventHandler = new WindowAdapter() {
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class RobocodeFrame extends JFrame {
|
||||||
private static final Cursor BUSY_CURSOR = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
|
private static final Cursor BUSY_CURSOR = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
|
||||||
private static final Cursor DEFAULT_CURSOR = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
|
private static final Cursor DEFAULT_CURSOR = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
private BattleObserver battleObserver;
|
private transient BattleObserver battleObserver;
|
||||||
|
|
||||||
private final InteractiveHandler interactiveHandler;
|
private final InteractiveHandler interactiveHandler;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class RobocodeFrame extends JFrame {
|
||||||
private final BattleView battleView;
|
private final BattleView battleView;
|
||||||
private final MenuBar menuBar;
|
private final MenuBar menuBar;
|
||||||
|
|
||||||
final List<RobotButton> robotButtons = new ArrayList<RobotButton>();
|
private final List<RobotButton> robotButtons = new ArrayList<RobotButton>();
|
||||||
|
|
||||||
public RobocodeFrame(ISettingsManager properties,
|
public RobocodeFrame(ISettingsManager properties,
|
||||||
IWindowManager windowManager,
|
IWindowManager windowManager,
|
||||||
|
@ -724,7 +724,7 @@ public class RobocodeFrame extends JFrame {
|
||||||
|
|
||||||
public void windowClosed(WindowEvent e) {
|
public void windowClosed(WindowEvent e) {
|
||||||
if (exitOnClose) {
|
if (exitOnClose) {
|
||||||
System.exit(0);
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,13 +947,13 @@ public class RobocodeFrame extends JFrame {
|
||||||
boolean dispTps = properties.getOptionsViewTPS();
|
boolean dispTps = properties.getOptionsViewTPS();
|
||||||
boolean dispFps = properties.getOptionsViewFPS();
|
boolean dispFps = properties.getOptionsViewFPS();
|
||||||
|
|
||||||
if (dispTps | dispFps) {
|
if (dispTps || dispFps) {
|
||||||
title.append(", ");
|
title.append(", ");
|
||||||
|
|
||||||
if (dispTps) {
|
if (dispTps) {
|
||||||
title.append(tps).append(" TPS");
|
title.append(tps).append(" TPS");
|
||||||
}
|
}
|
||||||
if (dispTps & dispFps) {
|
if (dispTps && dispFps) {
|
||||||
title.append(", ");
|
title.append(", ");
|
||||||
}
|
}
|
||||||
if (dispFps) {
|
if (dispFps) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class RobotButton extends JButton implements ActionListener {
|
||||||
|
|
||||||
private final IWindowManagerExt windowManager;
|
private final IWindowManagerExt windowManager;
|
||||||
private final IBattleManager battleManager;
|
private final IBattleManager battleManager;
|
||||||
private final BattleObserver battleObserver = new BattleObserver();
|
private final transient BattleObserver battleObserver = new BattleObserver();
|
||||||
private final IRobotDialogManager dialogManager;
|
private final IRobotDialogManager dialogManager;
|
||||||
private RobotDialog robotDialog;
|
private RobotDialog robotDialog;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class RobotDescriptionPanel extends JPanel {
|
||||||
|
|
||||||
private final static String BLANK_STRING = " ";
|
private final static String BLANK_STRING = " ";
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private class EventHandler implements ActionListener {
|
private class EventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class RobotDialog extends JFrame {
|
||||||
private boolean grayGreenButton;
|
private boolean grayGreenButton;
|
||||||
private final Map<String, String> debugProperties = new HashMap<String, String>();
|
private final Map<String, String> debugProperties = new HashMap<String, String>();
|
||||||
|
|
||||||
private final BattleObserver battleObserver = new BattleObserver();
|
private final transient BattleObserver battleObserver = new BattleObserver();
|
||||||
private final IWindowManager windowManager;
|
private final IWindowManager windowManager;
|
||||||
private final IBattleManager battleManager;
|
private final IBattleManager battleManager;
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,11 @@ public class RobotExtractor extends JDialog implements WizardListener {
|
||||||
private RobotSelectionPanel robotSelectionPanel;
|
private RobotSelectionPanel robotSelectionPanel;
|
||||||
|
|
||||||
public byte buf[] = new byte[4096];
|
public byte buf[] = new byte[4096];
|
||||||
private StringWriter output;
|
private transient StringWriter output;
|
||||||
private final IWindowManager windowManager;
|
private final IWindowManager windowManager;
|
||||||
private final IRepositoryManager repositoryManager;
|
private final IRepositoryManager repositoryManager;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
class EventHandler implements ActionListener {
|
class EventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class TeamCreator extends JDialog implements WizardListener {
|
||||||
private final int minRobots = 2;
|
private final int minRobots = 2;
|
||||||
private final int maxRobots = 10;
|
private final int maxRobots = 10;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
class EventHandler implements ActionListener {
|
class EventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class WizardCardPanel extends JPanel implements Wizard {
|
||||||
private CardLayout cardLayout = null;
|
private CardLayout cardLayout = null;
|
||||||
private int currentIndex = 0;
|
private int currentIndex = 0;
|
||||||
private final WizardListener listener;
|
private final WizardListener listener;
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
public class EventHandler implements ContainerListener {
|
public class EventHandler implements ContainerListener {
|
||||||
public void componentRemoved(ContainerEvent e) {}
|
public void componentRemoved(ContainerEvent e) {}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.awt.event.ActionListener;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class WizardController extends JPanel implements ChangeListener {
|
public class WizardController extends JPanel implements ChangeListener {
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private JButton backButton;
|
private JButton backButton;
|
||||||
private JButton nextButton;
|
private JButton nextButton;
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class WizardTabbedPane extends JTabbedPane implements Wizard {
|
||||||
private WizardController wizardController;
|
private WizardController wizardController;
|
||||||
private int currentIndex = 0;
|
private int currentIndex = 0;
|
||||||
private final WizardListener listener;
|
private final WizardListener listener;
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
public class EventHandler implements ContainerListener, ChangeListener {
|
public class EventHandler implements ContainerListener, ChangeListener {
|
||||||
public void componentRemoved(ContainerEvent e) {}
|
public void componentRemoved(ContainerEvent e) {}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class ColorUtil {
|
||||||
|
|
||||||
float H, S;
|
float H, S;
|
||||||
|
|
||||||
if (delta == 0) { // This is a gray, no chroma...
|
if (!delta) { // This is a gray, no chroma...
|
||||||
H = 0;
|
H = 0;
|
||||||
S = 0;
|
S = 0;
|
||||||
} else { // Chromatic data...
|
} else { // Chromatic data...
|
||||||
|
|
|
@ -167,9 +167,9 @@ public class FilenamePanel extends WizardPanel {
|
||||||
// Immediately reasserts the exception by interrupting the caller thread itself
|
// Immediately reasserts the exception by interrupting the caller thread itself
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,10 +275,7 @@ public class PackagerOptionsPanel extends WizardPanel {
|
||||||
e.getWindow().dispose();
|
e.getWindow().dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowClosed(WindowEvent e) {
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -287,9 +284,9 @@ public class PackagerOptionsPanel extends WizardPanel {
|
||||||
// Immediately reasserts the exception by interrupting the caller thread itself
|
// Immediately reasserts the exception by interrupting the caller thread itself
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log("context", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class RobotPackager extends JDialog implements WizardListener {
|
||||||
private final IRepositoryManager repositoryManager;
|
private final IRepositoryManager repositoryManager;
|
||||||
private final IWindowManager windowManager;
|
private final IWindowManager windowManager;
|
||||||
|
|
||||||
private final EventHandler eventHandler = new EventHandler();
|
private final transient EventHandler eventHandler = new EventHandler();
|
||||||
|
|
||||||
private class EventHandler implements ActionListener {
|
private class EventHandler implements ActionListener {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
Loading…
Reference in New Issue