Package dev.robocode.tankroyale.botapi
Class InitialPosition
- java.lang.Object
-
- dev.robocode.tankroyale.botapi.InitialPosition
-
public final class InitialPosition extends java.lang.Object
Initial starting position containing a start coordinate (x,y) and the shared direction of the body, gun, and radar.The initial position is only used when debugging to request the server to let a bot start at a specific position. Note that initial starting positions must be enabled at the server-side; otherwise the initial starting position is ignored.
-
-
Constructor Summary
Constructors Constructor Description InitialPosition(java.lang.Double x, java.lang.Double y, java.lang.Double direction)
Initializes a new instance of the InitialPosition class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static InitialPosition
fromString(java.lang.String initialPosition)
Creates new instance of the InitialPosition class from a string.java.lang.Double
getDirection()
Returns the shared direction of the body, gun, and radar;java.lang.Double
getX()
Returns the x coordinate;java.lang.Double
getY()
Returns the y coordinate;int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
InitialPosition
public InitialPosition(java.lang.Double x, java.lang.Double y, java.lang.Double direction)
Initializes a new instance of the InitialPosition class.- Parameters:
x
- is the x coordinate, wherenull
means it is random.y
- is the y coordinate, wherenull
means it is random.direction
- is the shared direction of the body, gun, and radar, wherenull
means it is random.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getX
public java.lang.Double getX()
Returns the x coordinate;- Returns:
- The x coordinate or
null
if no x coordinate is specified and a random value must be used.
-
getY
public java.lang.Double getY()
Returns the y coordinate;- Returns:
- The y coordinate or
null
if no y coordinate is specified and a random value must be used.
-
getDirection
public java.lang.Double getDirection()
Returns the shared direction of the body, gun, and radar;- Returns:
- The direction or
null
if no direction is specified and a random value must be used.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fromString
public static InitialPosition fromString(java.lang.String initialPosition)
Creates new instance of the InitialPosition class from a string.- Parameters:
initialPosition
- is comma and/or white-space separated string.- Returns:
- An InitialPosition instance.
-
-