Package robocode

Class _RobotBase

    • 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 java.lang.Runnable

        run
    • 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 class java.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 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