View source for User talk:Gertjan1996
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
5 errors, who can help me? | 24 | 16:33, 25 May 2014 |
I have to make a 1v1 robot | 2 | 20:13, 21 May 2014 |
Can someone tell me the problem here?? I dont get it :S
Compiling...
1. ERROR in C:\robocode\robots\MyRobots\Yeah.java (at line 22) turnRadarRightRadians(Double.POSITIVE_INFINITY); ^^^^^^^^^^^^^^^^^^^^^ The method turnRadarRightRadians(double) is undefined for the type Yeah
2. ERROR in C:\robocode\robots\MyRobots\Yeah.java (at line 36) getHeadingRadians() + e.getBearingRadians() ^^^^^^^^^^^^^^^^^ The method getHeadingRadians() is undefined for the type Yeah
3. ERROR in C:\robocode\robots\MyRobots\Yeah.java (at line 38) - getRadarHeadingRadians(); ^^^^^^^^^^^^^^^^^^^^^^ The method getRadarHeadingRadians() is undefined for the type Yeah
4. ERROR in C:\robocode\robots\MyRobots\Yeah.java (at line 40) setTurnRadarRightRadians(Utils.normalRelativeAngle(radarTurn)); ^^^^^ Utils cannot be resolved
5. ERROR in C:\robocode\robots\MyRobots\Yeah.java (at line 43) } ^ Syntax error, insert "}" to complete ClassBody
5 problems (5 errors) Compile Failed (-1)
This is my code:
package MyRobots;
import robocode.HitRobotEvent;
import robocode.Robot;
import robocode.ScannedRobotEvent;
import java.awt.*;
public class Yeah extends Robot {
public void run() { // Kleuren setBodyColor(Color.black); setGunColor(Color.black); setRadarColor(Color.black); setBulletColor(Color.black); setScanColor(Color.cyan);
// ...
turnRadarRightRadians(Double.POSITIVE_INFINITY); do { // Check for new targets. // Only necessary for Narrow Lock because sometimes our radar is already // pointed at the enemy and our onScannedRobot code doesn't end up telling // it to turn, so the system doesn't automatically call scan() for us // [see the javadocs for scan()]. scan(); } while (true);
}
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)); // ...
}
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);
}
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));
}
}
Nevermind, i fixed it already. Still thanks for your help
It now only has a radar :P
Still have to add the movement and targeting haha
You need to extend "AdvancedRobot" is all. Then it should work fine.
Ah right, a little late. Sorry about that.
Hello everyone,
I have to make a good 1v1 robot with robotclass .robot
The problem is: I can't even get better then the sample robot 'Walls'. Is there anyone who can help me to build a better, but not to difficult 1v1 robot?
I'd like to make a robot just like walls, but with a better radar. Which radar should I use? Also, almost every single shot i fire misses the opponent... How am I able to improbe that?
Gertjan
Its for school by the way
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:User talk:Gertjan1996/I have to make a 1v1 robot/reply (2).