public abstract class JRobot2017 extends Pilot
actions()
,
Serialized FormPilot.DropperCommand, Pilot.LauncherAmmunition
Constructor and Description |
---|
JRobot2017() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
actions()
At every simulation cycle every JRobot plans its next actions.
|
protected void |
addDebugArrow(Vector start,
Vector end)
Mit Hilfe dieser Funktion kann ein Bot einen Pfeil auf's Spielfeld
zeichnen.
|
protected void |
addDebugCrosshair(Vector position)
Mit Hilfe dieser Funktion kann ein Bot ein Kreuz auf's Spielfeld
zeichnen.
|
protected void |
addDebugLine(float x1,
float y1,
float x2,
float y2) |
protected void |
addDebugLine(Vector p1,
Vector p2)
Mit Hilfe dieser Funktion kann ein Bot eine Linie auf's Spielfeld
zeichnen.
|
protected static Angle |
down()
Dieser Winkel hat den Wert 90° oder 1/2 Pi.
|
jrobots.simulation.simulationObjects.BodyFactory |
getBodyFactory()
determines the favorite supplier this
Pilot is designed for. |
protected TerrainType |
getCurrentTerrain()
The
JRobot has a center mounted terrain sensor. |
protected static double |
getEnergyConsumptionEngine()
Each tyre is accelerated by an electric motor.
|
protected static double |
getEnergyProductionPerSecond()
The vehicle is powered by a fuel cell.
|
protected static int |
getFramesPerSecond()
The exact number of frames per second.
|
protected boolean |
getIsMovingInWrongDirection()
In race mode: Velocity is pointing in the backward racetrack hemisphere.
|
protected static double |
getMaxBackwardVelocity() |
protected static double |
getMaxForwardVelocity() |
protected Angle |
getOrientation()
Liefert die aktuelle Ausrichtung des Rumpfes.
Dieser Wert stimmt nicht immer genau mit dem Winkel des Geschwindigkeitsvektors überein, da der Bot auch seitlich rutschen kann (z.B. |
protected Vector |
getPosition()
Liefert die aktuelle absolute Position des JRobot in der Arena.
|
protected Vector |
getPosOfBestBot()
The position of the currently leading
JRobot is known. |
protected Vector |
getVelocity()
Liefert den aktuellen Geschwindigkeitsvektor des Bots.
|
protected static Angle |
left()
Dieser Winkel hat den Wert 180° oder Pi.
|
protected static Angle |
right()
Dieser Winkel hat den Wert 0° oder 0 Pi.
|
protected void |
setAutopilot(Angle direction,
double speed)
Diese Funktion aktiviert den Autopilot, welcher selbständig die
Geschwindigkeiten der beiden Panzerketten regelt.
Der Autopilot fährt so lange mit der angegebenen Geschwindigkeit in die angegebene Richtung, bis diese Funktion mit neuen Daten nochmals aufgerufen wird. |
protected void |
setBodyColor(java.awt.Color newColor)
Hiermit kann eine Farbe eingestellt werden, mit der das Bild des
Rumpfes gefiltert wird.
|
protected void |
setBoost()
Zündet einen mächtigen Booster,
der den JRobot einen Satz nach vorne machen lässt.
|
protected void |
setDebugLines(Vector[] points)
Mit Hilfe dieser Funktion kann ein Bot mehrere Linien auf's Spielfeld
zeichnen.
|
protected void |
setNameColor(java.awt.Color newNameColor)
Hiermit kann die Farbe des Schriftzuges verändert werden, der in der
Arena über dem Bot angezeigt wird.
|
protected static Angle |
up()
Dieser Winkel hat den Wert 270° oder 3/2 Pi.
|
getBodyColor, getEnergy, getHealth, getName, getNameColor, getTime, getTurretColor, init
protected abstract void actions()
Every JRobot has only limited knowledge of its surroundings. That limit is set by its sensors. Sensors in general are methods starting with get...:
Pilot.getTime()
,
getEnergyProductionPerSecond()
getPosition()
, getOrientation()
,
getVelocity()
, getEnergyConsumptionEngine()
,
getCurrentTerrain()
, getPosOfBestBot()
The JRobot is called for actions, which are will have effect in the next simulation cycle. Issued actions in general are methods starting with set...:
setAutopilot(Angle, double)
,
setBoost()
addDebugArrow(Vector, Vector)
,
addDebugCrosshair(Vector)
, addDebugLine(Vector, Vector)
setBodyColor(Color)
,
setNameColor(Color)
In package jrobots.utils there are several helper classes to be used as necessary.
You may want to add fields to your JRobot class.
While it is possible to use static fields, these are not affected by the timeline slider in the GUI, which makes debugging less practical. Please don't use static fields while you can avoid it.
Runtime and memory are watched by the framework. If a reasonable use of the framework is confined by
your programming, the responsible JRobot may be expelled from the competition.
Exceptions will be caught by the framework and the JRobot will be restarted.
Please be aware of exceptions on the console, as the robot loses its memory at every restart.
protected final void addDebugArrow(Vector start, Vector end)
Pilot
Alle Debug-Linien sind jeweils nur in dem Frame sichtbar, in dem sie hinzugefügt wurden. Für eine längere Anzeige müssen die Linien also in jedem Frame neu gesetzt werden.
protected final void addDebugCrosshair(Vector position)
Pilot
Alle Debug-Linien sind jeweils nur in dem Frame sichtbar, in dem sie hinzugefügt wurden. Für eine längere Anzeige müssen die Linien also in jedem Frame neu gesetzt werden.
position
- die Position des Kreuzesprotected final void addDebugLine(float x1, float y1, float x2, float y2)
protected final void addDebugLine(Vector p1, Vector p2)
Pilot
Alle Debug-Linien sind jeweils nur in dem Frame sichtbar, in dem sie hinzugefügt wurden. Für eine längere Anzeige müssen die Linien also in jedem Frame neu gesetzt werden.
p1
- Startpunkt der Liniep2
- Endpunkt der Linieprotected static final Angle down()
public final jrobots.simulation.simulationObjects.BodyFactory getBodyFactory()
Pilot
Pilot
is designed for.
Implementor is obligated to add the final modifier.
getBodyFactory
in class Pilot
BodyFactory
protected final TerrainType getCurrentTerrain()
Pilot
JRobot
has a center mounted terrain sensor.
Use it to determine which terrain is located at the current position.getCurrentTerrain
in class Pilot
TerrainType
protected static final double getEnergyConsumptionEngine()
protected static final double getEnergyProductionPerSecond()
protected static final int getFramesPerSecond()
protected final boolean getIsMovingInWrongDirection()
Pilot
getIsMovingInWrongDirection
in class Pilot
isMovingInWrongDirection
protected static final double getMaxBackwardVelocity()
protected static final double getMaxForwardVelocity()
protected final Angle getOrientation()
Pilot
protected final Vector getPosition()
Pilot
protected final Vector getPosOfBestBot()
Pilot
JRobot
is known.getPosOfBestBot
in class Pilot
protected final Vector getVelocity()
Pilot
protected static final Angle left()
protected static final Angle right()
protected final void setAutopilot(Angle direction, double speed)
Pilot
Hinweis: Der Bot kann vorwärts schneller als rückwärts fahren.
direction
- gewünschte Fahrtrichtung - in diese Richtung soll die Front zeigen.speed
- gewünschte Geschwindigkeit im Intervall [-1...+1].
Werte kleiner als Null fahren rückwärtsprotected final void setBodyColor(java.awt.Color newColor)
Pilot
protected final void setBoost()
Pilot
Selbstverständlich kostet das weit mehr Energie als auf dorthin auf gewöhnlichen Ketten zu gelangen, aber so kann der Bot seine Maximalgeschwindigkeit übertreffen.
Der Booster brennt einige Simulationszyklen lang, bevor er automatisch erlischt.
protected final void setDebugLines(Vector[] points)
Pilot
Alle Debug-Linien sind jeweils nur in dem Frame sichtbar, in dem sie hinzugefügt wurden. Für eine lüngere Anzeige müssen die Linien also in jedem Frame neu deklariert werden.
points
- Start- und Endpunkte der Linienprotected void setNameColor(java.awt.Color newNameColor)
Pilot
protected static final Angle up()