Thread history

Fragment of a discussion from User talk:Gertjan1996
Viewing a history listing
Jump to navigation Jump to search
Time User Activity Comment
No results

now show everyone the robot

Tmservo (talk)21:26, 21 May 2014

It now only has a radar :P

Still have to add the movement and targeting haha

Gertjan1996 (talk)21:28, 21 May 2014
Tmservo (talk)21:32, 21 May 2014

I think so, i tried Stop_And_Go and I only get one error... this is the error:

1. ERROR in C:\robocode\robots\MyRobots\Yeah.java (at line 31) setAhead(direction*36*Math.max(0,Math.signum(prevEnergy-e.getEnergy()))); ^^^^^^^^^ direction cannot be resolved to a variable

And this is the source: package MyRobots;

import robocode.AdvancedRobot; import robocode.ScannedRobotEvent; 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(getDistanceRemaining()==0.0){
	setAhead(direction*36*Math.max(0,Math.signum(prevEnergy-e.getEnergy())));

}

} } }

Gertjan1996 (talk)21:43, 21 May 2014

good because it doesn't get any easier from here

Tmservo (talk)21:47, 21 May 2014

I understand :P

The problem at the moment is that I can't solve the one problem in here

Gertjan1996 (talk)21:48, 21 May 2014