Package robocode
Class _RobotBase
- java.lang.Object
-
- robocode._RobotBase
-
- All Implemented Interfaces:
java.lang.Runnable
,IBasicRobot
- Direct Known Subclasses:
_Robot
,JuniorRobot
public abstract class _RobotBase extends java.lang.Object implements IBasicRobot, java.lang.Runnable
This is the base class of all robots used by the system. You should not inherit your robot on this class.You should create a robot that is derived from the
Robot
,AdvancedRobot
,JuniorRobot
,TeamRobot
, orRateControlRobot
class instead.- Since:
- 1.4
- Author:
- Flemming N. Larsen (original), Pavel Savara (contributor)
- See Also:
Robot
,JuniorRobot
,AdvancedRobot
,TeamRobot
,RateControlRobot
-
-
Field Summary
Fields Modifier and Type Field Description java.io.PrintStream
out
The output stream your robot should use to print.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
Called by the system to 'clean up' after your robot.void
setOut(java.io.PrintStream out)
Do not call this method!void
setPeer(IBasicRobotPeer peer)
Do not call this method! Your robot will simply stop interacting with the game.-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface robocode.robotinterfaces.IBasicRobot
getBasicEventListener, getRobotRunnable
-
-
-
-
Field Detail
-
out
public java.io.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()); }
-
-
Method Detail
-
finalize
protected final void finalize() throws java.lang.Throwable
Called by the system to 'clean up' after your robot. You may not override this method.- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
setOut
public final void setOut(java.io.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 interfaceIBasicRobot
- 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 interfaceIBasicRobot
- Parameters:
peer
- the robot peer supplied by the game
-
-