|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjrobots.simulation.simulationObjects.Pilot
jrobots.simulation.simulationObjects.JRobot2012_FH
public abstract class JRobot2012_FH
The jRobot designed for use as base class for deriving contest bots.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class jrobots.simulation.simulationObjects.Pilot |
---|
Pilot.DropperCommand, Pilot.LauncherAmmunition |
Field Summary | |
---|---|
protected static java.lang.String |
constants
Dieser String hält die Werte für die Konstanten. |
Fields inherited from class jrobots.simulation.simulationObjects.Pilot |
---|
DOWN, LEFT, memoryConsumption, RIGHT, UP |
Constructor Summary | |
---|---|
JRobot2012_FH()
|
Method Summary | |
---|---|
protected abstract void |
actions()
Every time the simulation has progressed, each Pilot may
plan the 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(Vector p1,
Vector p2)
Mit Hilfe dieser Funktion kann ein Bot eine Linie auf's Spielfeld zeichnen. |
protected static double |
getEnergyConsumptionEngine()
|
protected static double |
getEnergyConsumptionProjectile()
|
protected static double |
getEnergyConsumptionScanner()
|
protected static double |
getEnergyProductionPerFrame()
|
protected static int |
getFramesPerSecond()
|
double |
getHealth()
Der Zustand eines Panzer s reicht von 0.0 (nächster
Treffer verschrottet Panzer) bis 1.0 (voll intakt). |
protected Scan |
getLastScan()
Liefert das Ergebnis des letzten "Scanblitzes". |
protected static double |
getMaxArenaDiameter()
Zwei Panzer können sich nicht weiter als den zurückgegebenen Wert voneinander entfernen. |
protected static double |
getMaxBackwardVelocity()
|
protected static double |
getMaxForwardVelocity()
|
protected static Angle |
getMaxScanAperture()
Liefert den größtmöglichen Öffnungswinkel des Scanners. |
protected Angle |
getOrientation()
Liefert die aktuelle Ausrichtung des Panzerkörpers. |
protected Vector |
getPosition()
Liefert die aktuelle Position des Panzers im Spielfeld relativ zur oberen linken Ecke. |
protected static double |
getProjectileSpeed()
Liefert die Geschwindigkeit (in Meter pro Sekunde), mit der das Kanonenprojektil, das der Panzer verschiessen kann, fliegt. |
protected Vector |
getVelocity()
Liefert den aktuellen Geschwindigkeitsvektor des Panzers. |
protected boolean |
isScanFromNow()
Liefert true, wenn der aktuelle Scanwert im Scanner von diesem Frame stammt, also wenn gilt: getTime() == getLastScan().timeOfScan Der Scanner hat also am Anfang dieses Frames einen Scan durchgeführt. |
protected void |
setAutopilot(Angle direction,
double speed)
Diese Funktion aktiviert den Autopilot, welcher selbständig die Geschwindigkeiten der beiden Panzerketten regelt. |
protected void |
setBodyColor(java.awt.Color newColor)
Hiermit kann eine Farbe eingestellt werden, mit der das Bild des Panzerkörpers gefiltert wird. |
protected void |
setDebugText(java.lang.String text)
Übergibt dem Framework einen Text, den es direk unterhalb des umherfahrenden Bots anzeigt. |
protected void |
setLaunchProjectileCommand(Angle command)
Setzt die gewünschte Schussrichtung des Bots. |
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 void |
setScanAperture(Angle aperture)
Hiermit sagt man dem Scanner, mit welchem ?? |
protected void |
setScanDirection(Angle scanDirection)
Setzt die Richtung, in die der nächste "Scanblitz" gehen soll. |
protected void |
setTurretColor(java.awt.Color newColor)
Hiermit kann eine Farbe eingestellt werden, mit der das Bild des Panzerturms gefiltert wird. |
Methods inherited from class jrobots.simulation.simulationObjects.Pilot |
---|
getBodyColor, getEnergy, getNameColor, getSafeShootDistance, getTime, getTurretColor, init |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String constants
Constructor Detail |
---|
public JRobot2012_FH()
Method Detail |
---|
protected abstract void actions()
Pilot
may
plan the next actions. This is done through execution of this method.
The knowledge that a Pilot
has of the momentary simulation
state is limited to what its Panzer
's sensors may display.
Access to the Panzer's sensor states is best done via the following
methods:
Pilot.getTime()
, Pilot.getEnergy()
,
getEnergyProductionPerFrame()
getPosition()
, getOrientation()
,
getVelocity()
, getEnergyConsumptionEngine()
getLastScan()
, isScanFromNow()
,
getEnergyConsumptionScanner()
getProjectileSpeed()
,
getEnergyConsumptionProjectile()
A Pilot
is able to steer its Panzer
. Move
commands are obeyed by the Panzer until the Pilot canges its commands.
All other commands are comsumed when the Panzer tries to execute them.
Commands are issued by calling the following methods:
setAutopilot(Angle, double)
setScanDirection(Angle)
,
setScanAperture(Angle)
setLaunchProjectileCommand(Angle)
addDebugArrow(Vector, Vector)
,
addDebugCrosshair(Vector)
, addDebugLine(Vector, Vector)
setBodyColor(Color)
, setTurretColor(Color)
,
setNameColor(Color)
You may add fields as you like to your class to keep your state information through the run of the simulation.
But remember not to waste memory, as the framework checks the size of
your Pilot
's state and may refuse to permit it to the
arena.
You can use static fields, but that makes the framework's timeline
slider obsolete for debugging. So don't do it.
If you exceed a certain (very generous) threshold, the framework will
exert punishment upon your Pilot.
If your Pilot throws an Exception, there will also be some detriment.
In both cases, the framework will remove the existing Pilot instance and
put a new instance into the Panzer, so you may be able to carry on.
actions
in class Pilot
protected final void addDebugArrow(Vector start, Vector end)
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.
protected final void addDebugCrosshair(Vector position)
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.
position
- die Position des Kreuzesprotected final void addDebugLine(Vector p1, Vector p2)
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.
p1
- Startpunkt der Liniep2
- Endpunkt der Linieprotected static final double getEnergyConsumptionEngine()
protected static final double getEnergyConsumptionProjectile()
protected static final double getEnergyConsumptionScanner()
protected static final double getEnergyProductionPerFrame()
Hinweis: Nicht alles davon kann auch gespeichert werden.
protected static final int getFramesPerSecond()
public final double getHealth()
Panzer
s reicht von 0.0 (nächster
Treffer verschrottet Panzer) bis 1.0 (voll intakt). Sinkt der Zustand
unter einen Wert von 0.0, so ist der Kampf für diesen Panzer zu
Ende.
getHealth
in class Pilot
protected final Scan getLastScan()
protected static final double getMaxArenaDiameter()
protected static final double getMaxBackwardVelocity()
protected static final double getMaxForwardVelocity()
protected static final Angle getMaxScanAperture()
protected final Angle getOrientation()
protected final Vector getPosition()
protected static final double getProjectileSpeed()
protected final Vector getVelocity()
protected final boolean isScanFromNow()
protected final void setAutopilot(Angle direction, double speed)
direction
- gewünschte Fahrtrichtungspeed
- gewünschte Geschwindigkeit im Intervall [-1...+1]protected final void setBodyColor(java.awt.Color newColor)
protected final void setDebugText(java.lang.String text)
text
- anzuzeigender Textprotected final void setLaunchProjectileCommand(Angle command)
command
- Zielpunkt in Polarkoordinatenform relativ zum Panzerprotected final void setNameColor(java.awt.Color newNameColor)
protected final void setScanAperture(Angle aperture)
aperture
- ??ffnungswinkelprotected final void setScanDirection(Angle scanDirection)
setScanDirection(new RadAngle(Math.PI));
scanDirection
- gewünschte Scanrichtungprotected final void setTurretColor(java.awt.Color newColor)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |