traduccion de api robocode
TRANSCRIPT
TRADUCIDO POR R_CR_TE/* C:\robocode\javadoc\index.html */
Traducido de : -> IBasicEvents
Interface IBasicEvents
Method Summary Resumen de métodos
void onBulletHit(BulletHitEvent event) This method is called when one of your bullets hits another robot.// Este método se llama cuando uno de tus balas golpea a otro robot.
void onBulletHitBullet(BulletHitBulletEvent event) This method is called when one of your bullets hits another bullet.// Este método se llama cuando uno de tus balas golpea otra bala.
void onBulletMissed(BulletMissedEvent event) This method is called when one of your bullets misses, i.e. hits a wall.// Este método se llama cuando una de sus balas se pierde, es decir, golpea una pared.
void onDeath(DeathEvent event) This method is called if your robot dies.// Este método se llama, si el robot muere.
void onHitByBullet(HitByBulletEvent event) This method is called when your robot is hit by a bullet.// Este método se llama cuando el robot es alcanzado por una bala.
void onHitRobot(HitRobotEvent event) This method is called when your robot collides with another robot.// Este método es llamado cuando el robot choca con otro robot
void onHitWall(HitWallEvent event) This method is called when your robot collides with a wall.// Este método es llamado cuando el robot choca con una pared
void onRobotDeath(RobotDeathEvent event) This method is called when another robot dies.// Este método se llama cuando otro robot muere
void onScannedRobot(ScannedRobotEvent event) This method is called when your robot sees another robot, i.e. when the robot's radar scan "hits" another robot.// Este método se llama cuando el robot ve a otro robot, es decir, cuando el
radar del robot de exploración "éxitos" a otro robot.
void onStatus(StatusEvent event) This method is called every turn in a battle round in order to provide the robot status as a complete snapshot of the robot's current state at that specific time.// Este método se llama cada vez en una ronda de batalla a fin de proporcionar el estado del robot como una imagen completa del estado actual del robot, en ese momento.
void onWin(WinEvent event) This method is called if your robot wins a battle.// Este método se llama el robot si gana una batalla.
Metodo Detalle
void onStatus(StatusEvent event)
Este método se llama cada vez en una ronda de batalla a fin de proporcionar el estado del robot como una imagen completa del estado actual del robot, en ese momento.La principal ventaja de este método es que usted recibirá automáticamente todos los valores de los datos actuales del robot, como por ejemplo, las coordenadas X e Y, rumbo, etc pistola de aire caliente, que se agrupan en el momento exacto el mismo turno.
Esta es la única manera de asignar los valores de los datos robots para una hora específica. Por ejemplo, no es posible determinar la hora exacta del robot de la partida llamando Robot.getTime() primera llamada y luego Robot.getHeading () después, como el tiempo puede cambiar después de que entre los Robot.getTime () y Robot. getHeading () llamada.
Parámetros:event - el evento que contiene el estado del robot en el momento en que ocurrió.Desde:1.5Vea también:StatusEvent, evento
//------------------------------------------------------------------------------------------------------------------
StatusEvent, evento
Class StatusEvent
public final class StatusEventextends Event
Este evento se envía al onStatus () cada vez, en una batalla para proporcionar el estado del robot
Vea también:Serializado Formulario
Constructor Summary (“Constructor Resumen”)StatusEvent(RobotStatus status)
This constructor is called internally from the game in order to create a new RobotStatus.
// Este constructor es llamado internamente por el juego con el fin de crear una nueva RobotStatus.
.
Method Summary (“ Resumen de metodo”) RobotStatus getStatus()
Returns the RobotStatus at the time defined by Robot.getTime().// Devuelve el RobotStatus en el tiempo definido por Robot.getTime ().
Methods inherited from class robocode.Event (“Métodos heredados de la clase
robocode.Event”)
compareTo, getPriority, getTime, setPriority, setTime
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor detalle
StatusEvent
public StatusEvent(RobotStatus status)
Este constructor es llamado internamente por el juego con el fin de crear una nueva RobotStatus.
Parameters:
status - the current states
Metodo Detalle
getStatus
public RobotStatus getStatus()Devuelve el RobotStatus en el tiempo definido por Robot.getTime ().
Returns:
la RobotStatus en el tiempo definido por Robot.getTime ().
Vea también:
Event.getTime()
//---------------------------------------------------------------------------------------------------------------------------
onBulletHit
void onBulletHit(BulletHitEvent event)
Este método se llama cuando uno de tus balas golpea a otro robot. Usted debe reemplazar en el robot si quieres estar informado de este evento
Example:
public void onBulletHit(BulletHitEvent event) { out.println("I hit " + event.getName() + "!"); }
Parámetros:event - el evento de bala golpeó establecido por el juegoVea también:BulletHitEvent, event
//---------------------------------------------------------------------------------------------------------------------------
BulletHitEvent, event
Class BulletHitEvent
All Implemented Interfaces:
Serializable, Comparable
public final class BulletHitEventextends Event
Vease tambien:
Serialized Form
Constructor Summary (“ constructor resumen”)BulletHitEvent(String name, double energy, Bullet bullet) Called by the game to create a new BulletHitEvent.// Lo llama el juego para crear una nueva BulletHitEvent.
Method Summary (“Metodos resumen”) Bullet getBullet()
Returns the bullet of yours that hit the robot.// Devuelve la bala de los suyos que azotó el robot.
double getEnergy() Returns the remaining energy of the robot your bullet has hit (after the damage done by your bullet).// Devuelve la energía restante del robot ha llegado a su bala (después de los daños causados por la bala).
double getLife() Deprecated. Use BulletHitEvent.getEnergy() instead.// Obsoletas. Utilice BulletHitEvent.getEnergy () en lugar
String getName() Returns the name of the robot your bullet hit.// Devuelve el nombre del robot de su bala (pego)
double getRobotLife() Deprecated. Use BulletHitEvent.getEnergy() instead.
String getRobotName() Deprecated. Use BulletHitEvent.getName() instead.
Metodo Detalle
getBullet
public Bullet getBullet()Devuelve la bala de los suyos que azotó el robot
Returns:
la bala que golpeó el robot
getEnergy
public double getEnergy()Devuelve la energía restante del robot ha llegado a su bala (después de los daños causados por la bala).Returns:
la energía de la energía restante del robot que la bala ha afectado
getName
public String getName()Devuelve el nombre del robot de su bala
Returns:
el nombre del robot de la bala
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
onBulletHitBullet
void onBulletHitBullet(BulletHitBulletEvent event)
Este método se llama cuando uno de tus balas golpea otra bala. Usted debe reemplazar en el robot si quieres estar informado de este evento
Example:
public void onBulletHitBullet(BulletHitBulletEvent event) { out.println("I hit a bullet fired by " + event.getBullet().getName() + "!"); }
Parameters: event - the bullet-hit-bullet event set by the game //el evento de bala-golpear-bala establecido por el juegoVéase también;BulletHitBulletEvent, Event
//---------------------------------------------------------------------------------------------------------------------------
BulletHitBulletEvent
public final class BulletHitBulletEventextends Event
Este evento se envía al onBulletHitBullet cuando una de sus balas ha afectado a otra bala
Vease tambien:
Serialized Form
Constructor Summary (“Constructor Resumen”)BulletHitBulletEvent(Bullet bullet, Bullet hitBullet) Called by the game to create a new BulletHitEvent.// Lo llama el juego para crear una nueva BulletHitEvent
Method Summary (“Metodo Resumen”) Bullet getBullet()
Returns your bullet that hit another bullet.// Devuelve la bala que afectó a otra bala
Bullet getHitBullet() Returns the bullet that was hit by your bullet.// Devuelve la bala que fue alcanzado por la bala.
Methods inherited from class robocode.Event (“Métodos heredados de la clase
robocode.Event”)
compareTo, getPriority, getTime, setPriority, setTime
Methods inherited from class java.lang.Object (“Métodos heredados de la clase
java.lang.Object”)
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail (“Contructor Detalle”)
BulletHitBulletEvent
public BulletHitBulletEvent(Bullet bullet, Bullet hitBullet)
Lo llama el juego para crear una nueva BulletHitEvent
Parameters:
bullet - la bala que afectó a otra bala
hitBullet - la bala que fue alcanzado por la bala
Method Detail (“Metodo Detalle”)
getBullet
public Bullet getBullet()Devuelve la bala que afectó a otra bala
Returns:
su bala
getHitBullet
public Bullet getHitBullet()Devuelve la bala que fue alcanzado por la bala.
Returns:
la bala que fue golpeado
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
onBulletMissed
void onBulletMissed(BulletMissedEvent event)This method is called when one of your bullets misses, i.e. hits a wall. You should override it in your robot if you want to be informed of this event.
//Este método se llama cuando una de sus balas se pierde, es decir, golpea una pared. Usted debe reemplazar en el robot si quieres estar informado de este evento.
Example:
public void onBulletMissed(BulletMissedEvent event) { out.println("Drat, I missed."); } Parameters:
event - the bullet-missed event set by the game
// la bala-evento perdido fijados por el juego
Vease tambien:
BulletMissedEvent, Event
//---------------------------------------------------------------------------------------------------------------------------
BulletMissedEvent
Class BulletMissedEvent
All Implemented Interfaces:
Serializable, Comparable
public final class BulletMissedEventextends Event
Este evento se envía al onBulletMissed cuando una de sus balas se ha perdido, es decir, cuando la bala ha alcanzado la frontera del campo de batalla
Véase tambien:
Serialized Form
Constructor Summary (“Constructor Resumen”)BulletMissedEvent(Bullet bullet) Called by the game to create a new BulletMissedEvent.// Lo llama el juego para crear una nueva BulletMissedEvent.
Method Summary (“Metodo Resumen”) Bullet getBullet()
Returns the bullet that missed.// Devuelve la bala que se perdió.
Methods inherited from class robocode.Event (“Métodos heredados de la clase
robocode.Event”)
compareTo, getPriority, getTime, setPriority, setTime
Methods inherited from class java.lang.Object (“Métodos heredados de la clase
java.lang.Object”)
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail (“Constructor Detalle”)
BulletMissedEvent
public BulletMissedEvent(Bullet bullet)Lo llama el juego para crear una nueva BulletMissedEvent
Parameters:
bullet - la bala que se perdió
Method Detail (“Metodo detalle”)
getBulletpublic Bullet getBullet()
Devuelve la bala que se perdió
Returns:
la bala que se perdió
//---------------------------------------------------------------------------------------------------------------------------
onDeath
void onDeath(DeathEvent event)
Este método se llama, si el robot muere
Usted debe reemplazar en el robot si quieres estar informado de este evento. Las acciones no tienen ningún efecto si se llama desde esta sección. La intención es permitir que usted realice cálculos o imprimir algo cuando el robot es asesinado
Parameters:
event - el caso de la muerte establecido por el juego
Vease tambien:
DeathEvent, WinEvent, RoundEndedEvent, BattleEndedEvent, Event
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
onHitByBullet
void onHitByBullet(HitByBulletEvent event)
Este método se llama cuando el robot es alcanzado por una bala. Usted debe reemplazar en el robot si quieres estar informado de este evento.
Example:
void onHitByBullet(HitByBulletEvent event) { out.println(event.getRobotName() + " hit me!"); } Parameters:
event - the hit-by-bullet event set by the game
// el golpe-por-evento de bala establecido por el juego
Vaese tambien:
HitByBulletEvent, Event
//---------------------------------------------------------------------------------------------------------------------------
HitByBulletEvent
Class HitByBulletEvent
Un HitByBulletEvent se envía a onHitByBullet () cuando el robot ha sido alcanzado por una bala. Puede utilizar la información contenida en este evento para determinar qué hacer.
Constructor Summary (“Constructor Resumen”)HitByBulletEvent(double bearing, Bullet bullet) Called by the game to create a new HitByBulletEvent.// Lo llama el juego para crear una nueva HitByBulletEvent
Method Summary (“Metoso Resumen”) double getBearing()
Returns the bearing to the bullet, relative to your robot's heading, in degrees (-180 < getBearing() <= 180).//Devuelve el rumbo en relación con la bala, en relación con el robot de la partida, en grados (-180 <getBearing () <= 180).
double getBearingRadians() Returns the bearing to the bullet, relative to your robot's heading, in radians (-Math.PI < getBearingRadians() <= Math.PI).// Devuelve el rumbo en relación con la bala, en relación con el robot de la partida, en radianes (-Math.PI <getBearingRadians () <= Math.PI).
Bullet getBullet() Returns the bullet that hit your robot.// Devuelve la bala que afectó a su robot
double getHeading() Returns the heading of the bullet when it hit you, in degrees (0 <= getHeading() < 360).// Devuelve el título de la bala cuando te diste cuenta, en grados (0 <= getHeading () <360).
double getHeadingDegrees() Deprecated. Use HitByBulletEvent.getHeading() instead.// Obsoletas. Utilice HitByBulletEvent.getHeading () en lugar
double getHeadingRadians() Returns the heading of the bullet when it hit you, in radians (0 <= getHeadingRadians() < 2 * PI).
// Devuelve el título de la bala cuando te diste cuenta, en radianes (0 <= getHeadingRadians () <2 * PI).
String getName() Returns the name of the robot that fired the bullet.// Devuelve el nombre del robot que disparó la bala.
double getPower() Returns the power of this bullet.// Devuelve el poder de la bala.
double getVelocity() Returns the velocity of this bullet.// Devuelve la velocidad de la bala
Methods inherited from class robocode.Event
compareTo, getPriority, getTime, setPriority, setTime
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail (“Constructor Detalle”)
HitByBulletEventpublic HitByBulletEvent(double bearing, Bullet bullet)
Lo llama el juego para crear una nueva HitByBulletEvent
Parameters:
bearing - the bearing of the bullet that hit your robot, in radians
// el bearing de la bala que afectó a su robot, en radianes
bullet - la bala que ha afectado a su robot
Method Detail (“Metodo Detalle”)
getBearingpublic double getBearing()
Devuelve el rumbo en relación con la bala, en relación con el robot de la partida, en grados (-180 <getBearing () <= 180).
Si usted fuera a turnRight (event.getBearing ()), que se enfrenta la dirección de la bala vino. El cálculo se utiliza aquí es: (bala rumbo en grados + 180) - (su rumbo en grados)
Returns:
the bearing to the bullet, in degrees
// el bearing de la bala, en grados
getBearingRadians
public double getBearingRadians()
Devuelve el rumbo en relación con la bala, en relación con el robot de la partida, en radianes (-Math.PI <getBearingRadians () <= Math.PI).
Si usted fuera a turnRightRadians (event.getBearingRadians ()), que se enfrenta la dirección de la bala vino. El cálculo se utiliza aquí es: (bala partida en radianes + Math.PI) - (su dirección en radianes)
Returns:
el bearing de la bala, en radianes
getBullet
public Bullet getBullet()Devuelve la bala que afectó a su robot.
Returns:
la bala que afectó a su robot
getHeading
public double getHeading()Returns the heading of the bullet when it hit you, in degrees (0 <= getHeading() < 360).
// Devuelve el heading de la bala cuando te diste cuenta, en grados (0 <= getHeading () <360).
Nota: Esto no es relativa a la dirección en la que se enfrentan. El robot que disparó la bala fue en la dirección opuesta de getHeading () cuando se disparó la bala.
Returns:
the heading of the bullet, in degrees
// el heading de la bala, en grados
getHeadingRadians
public double getHeadingRadians()
Devuelve el heading de la bala cuando te diste cuenta, en radianes (0 <= getHeadingRadians () <2 * PI).
Nota: Esto no es relativa a la dirección en la que se enfrentan. El robot que disparó la bala fue en la dirección opuesta de getHeadingRadians () cuando se disparó la bala
Returns:
El heading de la bala, en radianes
getName
public String getName()Devuelve el nombre del robot que disparó la bala.
Returns:
el nombre del robot que disparó la bala
getPower
public double getPower()Returns the power of this bullet. The damage you take (in fact, already took) is 4 * power, plus 2 * (power-1) if power > 1. The robot that fired the bullet receives 3 * power back.
// Devuelve el poder de la bala. El daño que recibes (de hecho, ya se) es de 4 * power,plus 2 * (power-1) if power> 1. El robot que disparó la bala recibe energía de 3 *power back. (alimentacion)
Returns:
el poder de la bala
getVelocity
public double getVelocity()Devuelve la velocidad de la bala.
Returns:
la velocidad de la bala
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
onHitRobot
void onHitRobot(HitRobotEvent event)This method is called when your robot collides with another robot. You should override it in your robot if you want to be informed of this event.
Example:
void onHitRobot(HitRobotEvent event) { if (event.getBearing() > -90 && event.getBearing() <= 90) { back(100); } else { ahead(100); } } -- or perhaps, for a more advanced robot – - - -// o tal vez, para un robot más avanzado - - -
public void onHitRobot(HitRobotEvent event) {
if (event.getBearing() > -90 && event.getBearing() <= 90) {
setBack(100);
} else {
setAhead(100);
}
}
The angle is relative to your robot's facing. So 0 is straight ahead of you.
// El ángulo es relativo a su robot se enfrenta. Por lo que 0 es recto delante de usted
This event can be generated if another robot hits you, in which case event.isMyFault() will return false. In this case, you will not be automatically stopped by the game -- but if you continue moving toward the robot you will hit it (and generate another event). If you are moving away, then you won't hit it.
Este evento se puede generar si otro robot que realiza, en los que event.isMyFault() caso devolverá false. En este caso, no se detiene automáticamente por el juego -, pero si continúa avanzando hacia el robot que lo golpeó (y generar otro evento). Si se alejan, entonces no lo golpeó.
Parameters:
event - the hit-robot event set by the game
// el caso de éxito-robot establecido por el juego
Vease Tambien:
HitRobotEvent, Event
//---------------------------------------------------------------------------------------------------------------------------
HitRobotEvent
Class HitRobotEvent
public final class HitRobotEventextends Event
Un HitRobotEvent se envía a onHitRobot () cuando el robot choca con otro robot. Puede utilizar la información contenida en este evento para determinar qué hacer
Véase tambien:
Serialized Form
Constructor Summary (“Constructor Resumen”)HitRobotEvent(String name, double bearing, double energy, boolean atFault) Called by the game to create a new HitRobotEvent.// Lo llama el juego para crear una nueva HitRobotEvent
Method Summary (“Métodos Resumen") int compareTo(Event event)
Compares this event to another event regarding precedence.// Compara este evento a otro evento relacionadas con la precedencia
double getBearing() Returns the bearing to the robot you hit, relative to your robot's heading, in degrees (-180 <= getBearing() < 180)// Devuelve el bearing en relación con el robot te golpea, en relación con el robot de la partida, en grados (-180 <= getBearing () <180)
double getBearingDegrees() Deprecated. Use HitRobotEvent.getBearing() instead.// Obsoletas. Utilice HitRobotEvent.getBearing () en lugar
double getBearingRadians() Returns the bearing to the robot you hit, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)// Devuelve el bearing en relación con el robot le golpeó, en relación con el robot de la partida, en radianes (-PI <= getBearingRadians () <PI).
double getEnergy() Returns the amount of energy of the robot you hit.// Devuelve la cantidad de energía del robot te ha golpeado
String getName() Returns the name of the robot you hit.// Devuelve el nombre del robot te ha golpeado.
String getRobotName() Deprecated. Use HitRobotEvent.getName() instead.// Obsoletas. Utilice HitRobotEvent.getName () en lugar
boolean isMyFault() Checks if your robot was moving towards the robot that was hit.// Comprueba si el robot se movía hacia el robot que fue golpeado.
Methods inherited from class robocode.Event
getPriority, getTime, setPriority, setTime
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail (“Constructor Detalle”)
HitRobotEvent
Public HitRobotEvent(String name,double bearing,double energy,boolean atFault)
Called by the game to create a new HitRobotEvent.
// Lo llama el juego para crear una nueva HitRobotEvent
Parameters:
name - the name of the robot you hit
//el nombre del robot que golpeó
bearing - the bearing to the robot that your robot hit, in radians
// el rumbo hacia el robot que el robot éxito, en radianes
energy - the amount of energy of the robot you hit
// la cantidad de energía del robot que golpeó
atFault - true if your robot was moving toward the other robot; false otherwise
// true if el robot se movía hacia el otro robot, false en caso contrario
Method Detail (“Método Detalle”)
getBearing
public double getBearing()Returns the bearing to the robot you hit, relative to your robot's heading, in degrees (-180 <= getBearing() < 180)
// Devuelve el bearing en relación con el robot te golpea, en relación con el robot de la partida, en grados (-180 <= getBearing () <180)
Returns:
the bearing to the robot you hit, in degrees
// el bearing a la que golpeó robot, en grados
getBearingRadians
public double getBearingRadians()Returns the bearing to the robot you hit, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)
// Devuelve el rumbo en relación con el robot le golpeó, en relación con el robot de la partida, en radianes (-PI <= getBearingRadians () <PI)
Returns:
the bearing to the robot you hit, in radians
// el bearing a la que golpeó robot, en radianes
getEnergy
public double getEnergy()Devuelve la cantidad de energía del robot te ha golpeado.
Returns:
la cantidad de energía del robot que golpeó
getName
public String getName()Devuelve el nombre del robot que golpeó.
Returns:
el nombre del robot que golpeó
isMyFault
public boolean isMyFault()Comprueba si el robot se movía hacia el robot que fue golpeado
If HitRobotEvent.isMyFault() returns true then your robot's movement (including turning) will have stopped and been marked complete
If HitRobotEvent.isMyFault() devuelve true entonces el movimiento del robot (incluyendo consultas) se ha detenido y ha marcado completa.
Note: If two robots are moving toward each other and collide, they will each receive two HitRobotEvents. The first will be the one if HitRobotEvent.isMyFault() returns true.
// Nota: Si dos robots se mueven uno hacia el otro y chocan, que recibirán cada uno dos HitRobotEvents. El primero será el si HitRobotEvent.isMyFault() debuelve true.
Returns:
true si el robot se movía hacia el robot que fue golpeado, false en caso contrario
compareTo
public final int compareTo(Event event)
Compara este evento a otro evento relacionadas con la precedencia. La precedencia de eventos es, ante todo, determinado por la hora del evento, en segundo lugar la prioridad de eventos, y por último información sobre la prueba específica..
Este primer método se compara el tiempo de cada evento. Si la hora del evento es el mismo para ambos eventos, a continuación, este método de comparación la prioridad de cada caso. Si el evento prioridades son iguales, entonces este método se compara el evento de dos sobre la base de información de eventos específicos.
Este método es llamado por el juego con el fin de ordenar la cola de eventos de un robot para asegurarse de que los eventos se muestran en orden cronológico.
Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class Event
Parameters:
event - the event to compare to this event.
// el caso de comparar a este evento
Returns:
un valor negativo si este evento tiene mayor prioridad, es decir, deben estar inscritos antes del evento especificado. Un valor positivo si este evento tiene una prioridad más baja, es decir, debe aparecer después de que el evento especificado. 0 significa que la prioridad de los dos eventos son iguales
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
onHitWall
void onHitWall(HitWallEvent event)
Este método es llamado cuando el robot choca con una pared. Usted debe reemplazar en el robot si quieres estar informado de este evento.
The wall at the top of the screen is 0 degrees, right is 90 degrees, bottom is 180 degrees, left is 270 degrees. But this event is relative to your heading, so: The bearing is such that turnRight (event.getBearing()) will point you perpendicular to the wall.
// La pared en la parte superior de la pantalla es de 0 grados, a la derecha es de 90 grados, el fondo es de 180 grados, a la izquierda es de 270 grados. Pero este caso es relativo a su partida, así que: El rodamiento es tal que turnRight (event.getBearing ()) será punto perpendicular a la pared.
Example:
void onHitWall(HitWallEvent event) { out.println("Ouch, me golpeo una pared del bearing " + event.getBearing() + "grados."); } Parameters:
event - el caso de golpear la pared establecida por el juego
See Also:
HitWallEvent, Event
//---------------------------------------------------------------------------------------------------------------------------
HitWallEvent
Class HitWallEvent
public final class HitWallEventextends Event
A HitWallEvent is sent to onHitWall() when you collide a wall. You can use the information contained in this event to determine what to do.
// Un HitWallEvent se envía a onHitWall () cuando chocan una pared. Puede utilizar la información contenida en este evento para determinar qué hacer.
Véase tambien:
Serialized Form
Constructor SummaryHitWallEvent(double bearing)
Called by the game to create a new HitWallEvent.// Lo llama el juego para crear una nueva HitWallEvent
Method Summary double getBearing()
Returns the bearing to the wall you hit, relative to your robot's heading, in degrees (-180 <= getBearing() < 180)// Devuelve el rumbo en relación con la que golpeó la pared, en relación con el robot de la partida, en grados (-180 <= getBearing () <180)
double getBearingDegrees() Deprecated. Use HitWallEvent.getBearing() instead.// Obsoletas. Utilice HitWallEvent.getBearing () en lugar.
double getBearingRadians() Returns the bearing to the wall you hit, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)//Devuelve el rumbo en relación con la que golpeó la pared, en relación con el robot de la partida, en radianes (-PI <= getBearingRadians () <PI)
Methods inherited from class robocode.Event
compareTo, getPriority, getTime, setPriority, setTime
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail (“Constructor Detalle”)
HitWallEventpublic HitWallEvent(double bearing)
Called by the game to create a new HitWallEvent.
// Lo llama el juego para crear una nueva HitWallEvent
Parameters:
bearing - the bearing to the wall that your robot hit, in radian
// el rumbo hacia la pared que el robot éxito, en radianes
Method Detail (“Metodo Detalle”)
getBearing
public double getBearing()Devuelve el bearing en relación con la que golpeó la pared, en relación con el robot de la partida, en grados (-180 <= getBearing () <180)
Returns:
the bearing to the wall you hit, in degrees
// el bearing a la que golpeó la pared, en grados
getBearingRadians
public double getBearingRadians()Returns the bearing to the wall you hit, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)
// Devuelve el bearing en relación con la que golpeó la pared, en relación con el robot de la partida, en radianes (-PI <= getBearingRadians () <PI)
Returns:
the bearing to the wall you hit, in radians
// el bearing a la que golpeó la pared, en radianes
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
onScannedRobot
void onScannedRobot(ScannedRobotEvent event)This method is called when your robot sees another robot, i.e. when the robot's radar scan "hits" another robot. You should override it in your robot if you want to be informed of this event. (Almost all robots should override this!)
// Este método se llama cuando el robot ve a otro robot, es decir, cuando el radar del robot de exploración "éxitos" a otro robot. Usted debe reemplazar en el robot si quieres estar informado de este evento. (Casi todos los robots deben reemplazar este!)
This event is automatically called if there is a robot in range of your radar.
// Este evento se llama automáticamente si hay un robot dentro del alcance de su radar
Note that the robot's radar can only see robot within the range defined by Rules.RADAR_SCAN_RADIUS (1200 pixels).
// Tenga en cuenta que el radar del robot sólo puede ver robot dentro del rango definido por Rules.RADAR_SCAN_RADIUS (1200 píxeles).
Also not that the bearing of the scanned robot is relative to your robot's heading.
// Tampoco que el rodamiento del robot es escaneada en relación con el robot de la partida
Example:
void onScannedRobot(ScannedRobotEvent event) { // Assuming radar and gun are aligned... //Suponiendo que la pistola de radar y se alinean if (event.getDistance() < 100) { fire(3); } else { fire(1); } }
Note:The game assists Robots in firing, as follows:
If the gun and radar are aligned (and were aligned last turn), and the event is current, and you call fire() before taking any other actions, fire() will fire directly at
the robot.
//Tenga en cuenta:El juego ayuda a los robots en el fuego, de la siguiente manera:• Si el arma y el radar están alineados (y se alinearon la última vuelta),• y el evento es actual,• y llama de fire () antes de tomar cualquier otra acción, el fire () se dispara directamente en el robot.
In essence, this means that if you can see a robot, and it doesn't move, then fire will hit it.
// En esencia, esto significa que si usted puede ver un robot, y no se mueve, entonces el fuego lo golpeó
AdvancedRobots will NOT be assisted in this manner, and are expected to examine the event to determine if fire() would hit. (i.e. you are spinning your gun around, but by the time you get the event, your gun is 5 degrees past the robot).
//AdvancedRobots NO contará con la ayuda de esta manera, y se espera que examinar el caso para determinar si el fire () golpearía. (Es decir, que están girando alrededor de su arma, pero cuando usted consigue el evento, su arma es de 5 grados después de que el robot).
Parameters:
event - the scanned-robot event set by the game
// el caso de escaneado-robot establecido por el juego
Vease tambien:
ScannedRobotEvent, Event, Rules.RADAR_SCAN_RADIUS
//---------------------------------------------------------------------------------------------------------------------------
ScannedRobotEvent
Class ScannedRobotEvent
All Implemented Interfaces:
Serializable, Comparable
public class ScannedRobotEventextends Event
Un ScannedRobotEvent se envía a onScannedRobot () cuando se escanea un robot. Puede utilizar la información contenida en este evento para determinar qué hacer
Nota: No debe heredar de esta clase en su propia clase de evento! La lógica interna de esta clase de eventos pueden cambiar. Por lo tanto, el robot puede que no funcione en futuras versiones de Robocode, si decide heredar de esta clase.
Véase tambien:
Serialized Form
Constructor Summary (“Costructor Resumen”)ScannedRobotEvent() Deprecated. Use ScannedRobotEvent.ScannedRobotEvent(String, double, double, double, double, double) instead.// Obsoletas. Utilice ScannedRobotEvent.ScannedRobotEvent (String, dobles, dobles, dobles, dobles, dobles) en su lugar.
ScannedRobotEvent(String name, double energy, double bearing,
double distance, double heading, double velocity) Called by the game to create a new ScannedRobotEvent.// Lo llama el juego para crear una nueva ScannedRobotEvent
Method Summary (“Métodos Resumen”) int compareTo(Event event)
Compares this event to another event regarding precedence.// Compara este evento a otro evento relacionadas con la precedencia
double getBearing() Returns the bearing to the robot you scanned, relative to your robot's heading, in degrees (-180 <= getBearing() < 180)// Devuelve el rumbo en relación con el robot que ha analizado, en relación con el robot de la partida, en grados (-180 <= getBearing () <180).
double getBearingRadians() Returns the bearing to the robot you scanned, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)// Devuelve el rumbo en relación con el robot que ha analizado, en relación con el robot de la partida, en radianes (-PI <= getBearingRadians () <PI)
double getDistance() Returns the distance to the robot (your center to his center).// Devuelve la distancia al robot (el centro de su centro).
double getEnergy() Returns the energy of the robot.// Devuelve la energía del robot.
double getHeading() Returns the heading of the robot, in degrees (0 <= getHeading() < 360)// Devuelve el heading del robot, en grados (0 <= getHeading () <360)
double getHeadingRadians() Returns the heading of the robot, in radians (0 <= getHeading() < 2 * PI)//Devuelve el heading del robot, en radianes (0 <= getHeading () <2 * PI)
double getLife()
Deprecated. Use ScannedRobotEvent.getEnergy() instead.// Obsoletas. Utilice ScannedRobotEvent.getEnergy () en lugar.
String getName() Returns the name of the robot.// Devuelve el nombre del robot.
double getRobotBearing() Deprecated. Use ScannedRobotEvent.getBearing() instead.Obsoletas. Utilice ScannedRobotEvent.getBearing () en lugar.
double getRobotBearingDegrees() Deprecated. Use ScannedRobotEvent.getBearing() instead.Obsoletas. Utilice ScannedRobotEvent.getBearing () en lugar.
double getRobotBearingRadians() Deprecated. Use ScannedRobotEvent.getBearingRadians() instead.Obsoletas. Utilice ScannedRobotEvent.getBearingRadians () en lugar.
double getRobotDistance() Deprecated. Use ScannedRobotEvent.getDistance() instead.Obsoletas. Utilice ScannedRobotEvent.getDistance () en lugar.
double getRobotHeading() Deprecated. Use ScannedRobotEvent.getHeading() instead.
double getRobotHeadingDegrees() Deprecated. Use ScannedRobotEvent.getHeading() instead.
double getRobotHeadingRadians() Deprecated. Use ScannedRobotEvent.getHeadingRadians() instead.
double getRobotLife() Deprecated. Use ScannedRobotEvent.getEnergy() instead.
String getRobotName() Deprecated. Use ScannedRobotEvent.getName() instead.
double getRobotVelocity() Deprecated. Use ScannedRobotEvent.getVelocity() instead.
double getVelocity() Returns the velocity of the robot.// Devuelve la velocidad del robot.
Methods inherited from class robocode.Event
getPriority, getTime, setPriority, setTime
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail (“Construstor Detalle”)
ScannedRobotEventpublic ScannedRobotEvent(String name, double energy, double bearing, double distance, double heading, double velocity)
Called by the game to create a new ScannedRobotEvent.
// Lo llama el juego para crear una nueva ScannedRobotEvent
Parameters:
name - the name of the scanned robot
//El nombre del robot escaneada
energy - the energy of the scanned robot
// la energía de los escaneados robot
bearing - the bearing of the scanned robot, in radians
//el bearing del escaneado del robot, en radianes
distance - the distance from your robot to the scanned robot
// la distancia de su robot para el escaneado del robot
heading - the heading of the scanned robot
// el título de la imagen escaneada del robot
velocity - the velocity of the scanned robot
// la velocidad de escaneado robot
Method Detail (“Metodo Detalle”)
getBearing
public double getBearing()Returns the bearing to the robot you scanned, relative to your robot's heading, in degrees (-180 <= getBearing() < 180)
// Devuelve el rumbo en relación con el robot que ha analizado, en relación con el robot de la partida, en grados (-180 <= getBearing () <180)
Returns:
the bearing to the robot you scanned, in degrees
// el rumbo hacia el robot que escanea, en grados
getBearingRadians
public double getBearingRadians()Returns the bearing to the robot you scanned, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)
// Devuelve el bearing en relación con el robot que ha analizado, en relación con el robot de la partida, en radianes (-PI <= getBearingRadians () <PI)
Returns:
the bearing to the robot you scanned, in radians
// el rumbo hacia el robot que escanea, en radianes
getDistance
public double getDistance()Devuelve la distancia al robot (el centro de su centro).
Returns:
la distancia al robot
getEnergy
public double getEnergy()Returns the energy of the robot.
// Devuelve la energía del robot
Returns:
la energía del robot
getHeading
public double getHeading()Returns the heading of the robot, in degrees (0 <= getHeading() < 360)
// Devuelve el heading del robot, en grados (0 <= getHeading () <360)
Returns:
the heading of the robot, in degrees
// el heading del robot, en grados
getHeadingRadians
public double getHeadingRadians()Returns the heading of the robot, in radians (0 <= getHeading() < 2 * PI)
// Devuelve el heading del robot, en radianes (0 <= getHeading () <2 * PI)
Returns:
the heading of the robot, in radians
// el título del robot, en radianes
getName
public String getName()Returns the name of the robot.
// Devuelve el nombre del robot.
Returns:
el nombre del robot
getVelocity
public double getVelocity()Devuelve la velocidad del robot.
Returns:
la velocidad del robot
compareTo
public final int compareTo(Event event)Compares this event to another event regarding precedence. The event precedence is first and foremost determined by the event time, secondly the event priority, and lastly specific event information.
// Compara este evento a otro evento relacionadas con la precedencia. La precedencia de eventos es, ante todo, determinado por la hora del evento, en segundo lugar la prioridad de eventos, y por último información sobre la prueba específica.
This method will first compare the time of each event. If the event time is the same for both events, then this method compared the priority of each event. If the event priorities are equals, then this method will compare the two event based on specific event information.
// Este primer método se compara el tiempo de cada evento. Si la hora del evento es el mismo para ambos eventos, a continuación, este método de comparación la prioridad de cada caso. Si el evento prioridades son iguales, entonces este método se compara el evento de dos sobre la base de información de eventos específicos.
This method is called by the game in order to sort the event queue of a robot to make sure the events are listed in chronological order.
// Este método es llamado por el juego con el fin de ordenar la cola de eventos de un robot para asegurarse de que los eventos se muestran en orden cronológico
Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class Event
Parameters:
event - the event to compare to this event.
// caso de comparar a este evento.
Returns:
a negative value if this event has higher precedence, i.e. must be listed before the specified event. A positive value if this event has a lower precedence, i.e. must be listed after the specified event. 0 means that the precedence of the two events are equal.
// un valor negativo si este evento tiene mayor prioridad, es decir, deben estar inscritos antes del evento especificado. Un valor positivo si este evento tiene
una prioridad más baja, es decir, debe aparecer después de que el evento especificado. 0 significa que la prioridad de los dos eventos son iguales.
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
onRobotDeath
void onRobotDeath(RobotDeathEvent event)Este método se llama cuando otro robot muere. Usted debe reemplazar en el robot si quieres estar informado de este evento
Parameters:
event - The robot-death event set by the game
// El caso del robot de la muerte establecido por el juego
See Also:
RobotDeathEvent, Event
onWin
void onWin(WinEvent event)This method is called if your robot wins a battle.
Your robot could perform a victory dance here! :-)
// Este método se llama el robot si gana una batalla.El robot puede realizar una danza de la victoria aquí! :-)
Parameters: event - the win event set by the game
// el caso de ganar establecido por el juego
Vease tambien:
DeathEvent, RoundEndedEvent, BattleEndedEvent, Event