robocode
Class _RobotBase
java.lang.Object
robocode._RobotBase
- All Implemented Interfaces:
- Runnable, IBasicRobot
- Direct Known Subclasses:
- _Robot, JuniorRobot
public abstract class _RobotBase
- extends Object
- implements IBasicRobot, Runnable
This is the base class of all robots used by the system. You should not base
your robots on this class.
You should create a robot that is derived from the Robot
or
JuniorRobot
class instead.
There is no guarantee that this class will exist in future versions of Robocode.
- Since:
- 1.4
- Author:
- Flemming N. Larsen (original), Pavel Savara (contributor)
- See Also:
Robot
,
JuniorRobot
,
AdvancedRobot
,
TeamRobot
Field Summary |
PrintStream |
out
The output stream your robot should use to print. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
run |
out
public PrintStream out
- The output stream your robot should use to print.
You can view the print-outs by clicking the button for your robot in the
right side of the battle window.
Example:
// Print out a line each time my robot hits another robot
public void onHitRobot(HitRobotEvent e) {
out.println("I hit a robot! My energy: " + getEnergy() + " his energy: " + e.getEnergy());
}
_RobotBase
public _RobotBase()
setOut
public final void setOut(PrintStream out)
- Do not call this method!
This method is called by the game when setting the output stream for your
robot.
- Specified by:
setOut
in interface IBasicRobot
- Parameters:
out
- the new output print stream for this robot
setPeer
public final void setPeer(IBasicRobotPeer peer)
- Do not call this method! Your robot will simply stop interacting with
the game.
This method is called by the game. A robot peer is the object that deals
with game mechanics and rules, and makes sure your robot abides by them.
- Specified by:
setPeer
in interface IBasicRobot
- Parameters:
peer
- the robot peer supplied by the game