5 errors, who can help me?
I understand :P
The problem at the moment is that I can't solve the one problem in here
What You Want To Do Is Say. Remember The Solution To The Error Repeatedly. And Then The Answer Will Come To You. In Other Words Rememberance
Trying to find a solution for
Compiling...
1. ERROR in C:\robocode\robots\Yeah.java (at line 21) setAhead(direction*36*Math.max(0,Math.signum(prevEnergy-e.getEnergy()))); ^^^^^^^^^ direction cannot be resolved to a variable
1 problem (1 error) Compile Failed (-1)
Not able to find a solution.. :(
Finally. Solved the problem :D Now i have a working radar and the Stop And Go movement.
Do I now only have to add the GuessFactor Targeting?
Where do I have to add the new class Wave Bullet?
examine this code carefully
import java.awt.geom.*;
import robocode.util.Utils;
public class WaveBullet
{
private double startX, startY, startBearing, power;
private long fireTime;
private int direction;
private int[] returnSegment;
public WaveBullet(double x, double y, double bearing, double power,
int direction, long time, int[] segment)
{
startX = x;
startY = y;
startBearing = bearing;
this.power = power;
this.direction = direction;
fireTime = time;
returnSegment = segment;
}
I am sure this is not good, but where am i going wrong?
import robocode.AdvancedRobot; import robocode.ScannedRobotEvent; import java.awt.geom.*; import robocode.util.Utils;
public class WaveBullet { private double startX, startY, startBearing, power; private long fireTime; private int direction; private int[] returnSegment;
public WaveBullet(double x, double y, double bearing, double power, int direction, long time, int[] segment) { startX = x; startY = y; startBearing = bearing; this.power = power; this.direction = direction; fireTime = time; returnSegment = segment; }
public class Yeah extends AdvancedRobot { public void run() {
turnRadarRightRadians(Double.POSITIVE_INFINITY); do { scan(); } while (true);
} static double prevEnergy = 100.0; public void onScannedRobot(ScannedRobotEvent e) {
double radarTurn = // Absolute bearing to target getHeadingRadians() + e.getBearingRadians() // Subtract current radar heading to get turn required - getRadarHeadingRadians();
setTurnRadarRightRadians(Utils.normalRelativeAngle(radarTurn));
{ //energy monitoring
if(prevEnergy > (prevEnergy = e.getEnergy()) && getDistanceRemaining() == 0.0);
} } }
How to solve this..
Compiling...
1. ERROR in C:\robocode\robots\Yeah.java (at line 26) public class WaveBullet ^^^^^^^^^^ The public type WaveBullet must be defined in its own file
1 problem (1 error) Compile Failed (-1)
Source code right now:
import robocode.AdvancedRobot; import robocode.ScannedRobotEvent; import java.awt.geom.*; import robocode.util.Utils;
public class Yeah extends AdvancedRobot { public void run() {
turnRadarRightRadians(Double.POSITIVE_INFINITY); do { scan(); } while (true);
} static double prevEnergy = 100.0; public void onScannedRobot(ScannedRobotEvent e) {
double radarTurn = // Absolute bearing to target getHeadingRadians() + e.getBearingRadians() // Subtract current radar heading to get turn required - getRadarHeadingRadians();
setTurnRadarRightRadians(Utils.normalRelativeAngle(radarTurn));
{ //energy monitoring
if(prevEnergy > (prevEnergy = e.getEnergy()) && getDistanceRemaining() == 0.0);
} } }
public class WaveBullet { private double startX, startY, startBearing, power; private long fireTime; private int direction; private int[] returnSegment;
public WaveBullet(double x, double y, double bearing, double power, int direction, long time, int[] segment) { startX = x; startY = y; startBearing = bearing; this.power = power; this.direction = direction; fireTime = time; returnSegment = segment; } }
you might want to use http://webchat.freenode.net/?channels=%23robocode