Simple robots extend Robot. They don't take damage when they hit walls, and can't use non-BlockingCall?s, CustomEvents or access files. They can use FiringAssistance (due to a bug, so can AdvancedRobots).
More complex robots extend AdvancedRobot.
-- JohnDoe
Yes, but they are few. There is an ExtendsRobot competition somewhere on this wiki, kawigi.robot.Girl, for example, also competes in the roborumble and meleerumble. I don't recommend starting out learning Robocode by trying to make a competitive Robot. -- Martin
Typically the source of such a question is competitions that don't allow AdvancedRobots (usually with the purpose of making it less likely that people will steal code from existing bots on the Repository). -- Kawigi
Ah, so you are suggesting that the anonymous poster is trying to cheat in a class competition. Lame. -- Martin
I'm not saying that's necessarily the case, just that it's quite possible :-) Also, I have been contacted before by a person asking if they could use some part of Girl in that kind of competition (although it was someone that I knew from another programming community). Girl is good partly because it is a robot designed without the limitations of an ExtendsRobot in consideration, and then adjusting things to allow for those limitations. -- Kawigi
Can I split movement into a Thread and use these Thread to create a non-blocking call? -- Nat
EDIT: I've try that, using following code:
public class RobotTest extends Robot { protected Thread move1; protected Thread move2; public void run() { move1 = new Thread(new Move1(this)); move2 = new Thread(new Move2(this)); move1.start(); move2.start(); while (true); } } class Move1 implements Runnable { Robot robot; public Move1(Robot r) { robot = r; } public void run() { while (true) { robot.ahead(100); } } } class Move2 implements Runnable { Robot robot; public Move2(Robot r) { robot = r; } public void run() { while (true) { robot.turnLeft(360); } } }But when it being call for the second time, I've got this exception:
Exception in thread "Thread-57" robocode.exception.RobotException: You cannot take action in this thread! at robocode.peer.RobotPeer.execute(Unknown Source) at robocode.peer.RobotPeer.move(Unknown Source) at robocode.peer.proxies.BasicRobotProxy.move(Unknown Source) at robocode.Robot.ahead(Unknown Source) at nat.robot.Move1.run(RobotTest.java:30) at java.lang.Thread.run(Unknown Source) Exception in thread "Thread-58" robocode.exception.RobotException: You cannot take action in this thread! at robocode.peer.RobotPeer.execute(Unknown Source) at robocode.peer.RobotPeer.turnBody(Unknown Source) at robocode.peer.proxies.BasicRobotProxy.turnBody(Unknown Source) at robocode.Robot.turnLeft(Unknown Source) at nat.robot.Move2.run(RobotTest.java:46) at java.lang.Thread.run(Unknown Source)Do you know why? -- Nat