Thread history
From User talk:Gertjan96
Viewing a history listing
Jump to navigation
Jump to search
Viewing a history listing
Time | User | Activity | Comment |
---|---|---|---|
20:08, 15 June 2014 | Gertjan96 (talk | contribs) | New thread created | |
20:09, 15 June 2014 | Gertjan96 (talk | contribs) | Comment text edited | |
21:32, 15 June 2014 | Gertjan96 (talk | contribs) | New reply created | (Reply to Simple robot - improvements, help wanted?) |
21:40, 15 June 2014 | Gertjan96 (talk | contribs) | New reply created | (Reply to Simple robot - improvements, help wanted?) |
21:22, 16 June 2014 | Tmservo (talk | contribs) | New reply created | (Reply to Simple robot - improvements, help wanted?) |
21:22, 16 June 2014 | Tmservo (talk | contribs) | Comment text edited | |
07:14, 19 June 2014 | Chase-san (talk | contribs) | Comment text edited | (syntax highlight) |
Hello,
I have to hand my teacher the robotcode code for my robot next wednesday. It doesn't have to be a very difficult robot, so I have made this robot today. Against the sample robots, it wins against the most of them, but not all of them.
Is there anyone who can help me to improve this code? Here is the code:
package MyRobots;
import robocode.*;
import java.awt.Color;
public class Fireintheass extends AdvancedRobot
{
double distance = 10;
public void run() {
setColors(Color.pink, Color.pink, Color.pink, Color.white, Color.pink);
setAdjustRadarForGunTurn(true);
setTurnRadarRight(360);
while(true) {
ahead(distance + 100);
back(distance);
}
}
public void onScannedRobot(ScannedRobotEvent e) {
turnRight(e.getBearing());
distance = e.getDistance();
if (e.getVelocity() == 0)
{
fire(3);
}
setTurnRadarRight(360);
}
}