Difference between revisions of "Robocode/Robot Console"

From Robowiki
Jump to navigation Jump to search
m (oops)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
This page will explain how to use the Robot Console for your robot.
+
This page will explain how to use the robot console for your robot.
  
== The Robot Console ==
+
== 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 from the [[Robocode]] game. Information is printed out by the robot using e.g. <code>System.out.print()</code>, <code>System.err.println()</code>, <code>out.println()</code>, and similar.
 
  
But 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 the game itself. NOTE: If exceptions occur in a robot that is not catched/handled inside the robot, the game will catch the exception of the robot 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, but also where in robot it went wrong (can be seen using the stack trace).
+
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 [http://robocode.sourceforge.net/docs/robocode/robocode/_RobotBase.html#out <code>out.println()</code>].
 +
 
 +
Information can also be printed out from the game about events that involves the robot. Such information will be prefixed with "<tt>SYSTEM: </tt>", 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.
 
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.
  
== How to open the Console Window ==
+
== Opening the robot console ==
So, when you want to read the output for your robot, you just have to open the console window of your robot. NOTE: In order to be able to open a console window of a robot, the robot must first be [[Robocode/Getting Started|added to the current battle]] as participant.
+
In order to be able to open a console window of a robot, the robot must first be [[Robocode/Getting Started|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:
 
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:
Line 15: Line 18:
 
[[Image:RobotConsoleButtons.png|Shows the Robot Console buttons on the right side of the battle view, where the mouse pointer is pointing at the console button for the sample robot named Corner]]
 
[[Image:RobotConsoleButtons.png|Shows the Robot Console buttons on the right side of the battle view, where the mouse pointer is pointing at the console button for the sample robot named Corner]]
  
 
+
== Using the the console window ==
== Usage of the Console Window ==
 
  
 
When you have clicked on the button for the robot, the following console window will pop up:
 
When you have clicked on the button for the robot, the following console window will pop up:
  
 
[[Image:RobotConsole.png|Shows the Robot Console window for the sample robot named Corner]]
 
[[Image:RobotConsole.png|Shows the Robot Console window for the sample robot named Corner]]
 
  
 
As you can see on the image above, the Robot Console window contains some buttons, which are described here:
 
As you can see on the image above, the Robot Console window contains some buttons, which are described here:
  
{| style="text-align:left"
+
* '''OK''' ‒ Closes the window.
! OK
+
* '''Clear''' ‒ Clears all the text printed in the console.
| Closes the window
+
* '''Kill Robot''' ‒ Artificially kills the robot.
|-
+
* '''Paint''' ‒ Enables painting for the robot, for [[Robocode/Graphical Debugging|graphical debugging]].
! Clear
+
* '''Robocode SG''' ‒ Enables graphics compatibility mode with a robot coded for [[oldwiki:RobocodeSG|Robocode Swing Graphics]].
| Clears all the text printed in the console
+
* '''Pause/Debug''' ‒ Pauses/resumes the game. Can be used when debugging.
|-
 
! Kill Robot
 
| Kills the robot
 
|-
 
! Paint
 
| Enables/disables painting the robot (using the <code>onPaint</code> method)
 
|-
 
! Robocode SG
 
| Enables/disables compability mode with a robot coded for [[RobocodeSG|Robocode SG]]
 
|-
 
! Pause/Debug
 
| Pauses/resumes the game. The pause mode can be used when debugging
 
|}
 
  
 
== See also ==
 
== See also ==
  
=== Robot API ===
+
{{RobocodeDocsList}}
* [http://robocode.sourceforge.net/docs/robocode/ Robot API]
 
 
 
=== Tutorials ===
 
* [[Robocode/System Requirements|System Requirements for Robocode]]
 
* [[Robocode/Download|How to download and install Robocode]]
 
* [[Robocode/Robot Anatomy|The anatomy of a robot]]
 
* [[Robocode/Getting Started|Getting started with Robocode]]
 
* [[Robocode/My First Robot|My First Robot Tutorial]]
 
* [[Robocode/Game Physics|Robocode Game Physics]]
 
* [[Robocode/Scoring|Scoring in Robocode]]
 
* [[Robocode/Downloading_Robots|Downloading other robots]]
 
* [[Robocode/Learning from Robots|Learning from other robots]]
 
* [[Robocode/Package Robot|Package your robot]]
 
* [[Robocode/FAQ|Frequently Asked Questions (FAQ)]]
 
* [[Robocode/Articles|Articles about Robocode]]
 
* [[Robocode/Console Usage|Starting Robocode from the command line]]
 
* [[Robocode/Graphical_Debugging|Graphical debugging]]
 
* [[Robocode/Eclipse|Using Eclipse as IDE]]
 
* [[Robocode/Eclipse/Create_a_Project|Creating a project for your robots]]
 
* [[Robocode/Eclipse/Create_a_Robot|Creating a robot in Eclipse]]
 
* [[Robocode/Running from Eclipse|Running your robot from Eclipse]]
 
* [[Robocode/Eclipse/Debugging Robot|Debugging your robot with Eclipse]]
 
 
 
=== News and Releases ===
 
* [http://sourceforge.net/export/rss2_project.php?group_id=37202 RSS Feeds for the Robocode project]
 
* [http://sourceforge.net/project/showfiles.php?group_id=37202&package_id=29609 Robocode file releases]
 
 
 
=== Home pages ===
 
* [http://robocode.sourceforge.net/ Classic homepage]
 
* [http://sourceforge.net/projects/robocode Robocode project at SourceForge]
 
* [http://robocoderepository.com/ Robocode Repository]
 
* [[wikipedia:Robocode|Wikipediaentry for Robocode]]
 
  
 
[[Category:Robocode Documentation]]
 
[[Category:Robocode Documentation]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 
[[Category:Debugging]]
 
[[Category:Debugging]]

Latest revision as of 02:46, 11 August 2017

This page will explain how to use the robot console for your robot.

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:

Shows the Robot Console buttons on the right side of the battle view, where the mouse pointer is pointing at the console button for the sample robot named Corner

Using the the console window

When you have clicked on the button for the robot, the following console window will pop up:

Shows the Robot Console window for the sample robot named Corner

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

External Editors

.NET Robots

Links