Robocode/Robot Console
This page will explain how to use the robot console for your robot.
Contents
The robot console
The robot console is a window that first and foremost contains information dedicated to an individual robot. The information is printed out by the robot itself or by the game engine. Information is printed by the robot by using out.println()
.
Information can also be printed out from the game about events that involves the robot. Such information will be prefixed with "SYSTEM: ", so you know that the information comes from Robocode itself.
If an exception occurs in a robot that is not caught/handled inside the robot, the game will catch the exception and dump the stack trace of the exception to the console. This is done to notify the developer of the robot that something went wrong inside the robot, and also where in robot it went wrong.
Thus, if your robot does not behave as you expect, it might be a very good idea to open the console window for your robot and see if the robot is causing an exception, is skipping turns, or something else.
Opening the robot console
In order to be able to open a console window of a robot, the robot must first be added to the current battle as participant.
The console window of a robot is opened by clicking on the button on the right side of the battle view, which contains the name of the robot you want to open the console window for:
Using the the console window
When you have clicked on the button for the robot, the following console window will pop up:
As you can see on the image above, the Robot Console window contains some buttons, which are described here:
- OK ‒ Closes the window.
- Clear ‒ Clears all the text printed in the console.
- Kill Robot ‒ Artificially kills the robot.
- Paint ‒ Enables painting for the robot, for graphical debugging.
- Robocode SG ‒ Enables graphics compatibility mode with a robot coded for Robocode Swing Graphics.
- Pause/Debug ‒ Pauses/resumes the game. Can be used when debugging.
See also
Robocode API
Beginner Guides
- Welcome to Robocode
- System requirements
- Download and install
- Getting started
- Frequently asked questions
- My First Robot tutorial
- Game physics
- The anatomy of a robot
- Scoring in Robocode
- Using the robot console
- Downloading other robots
- Learning from other robots
- Package your robot
- Articles about Robocode
- Starting Robocode from the command line
- Graphical debugging
External Editors
- Using Eclipse with Robocode
- Creating a project in Eclipse
- Creating a robot in Eclipse
- Running your robot from Eclipse
- Debugging your robot with Eclipse
- Using NetBeans with Robocode
- Using Gradle with Robocode