Package dev.robocode.tankroyale.botapi
Class InitialPosition
- Object
-
- InitialPosition
-
public final class InitialPosition extends 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(Double x, Double y, 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(Object o)
static InitialPosition
fromString(String initialPosition)
Creates a new instance of the InitialPosition class from a string.Double
getDirection()
Returns the shared direction of the body, gun, and radar;Double
getX()
Returns the x coordinate;Double
getY()
Returns the y coordinate;int
hashCode()
String
toString()
-
-
-
Constructor Detail
-
InitialPosition
public InitialPosition(Double x, Double y, 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(Object o)
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classObject
-
getX
public 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 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 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 String toString()
- Overrides:
toString
in classObject
-
fromString
public static InitialPosition fromString(String initialPosition)
Creates a new instance of the InitialPosition class from a string.- Parameters:
initialPosition
- is comma and/or white-space separated string.- Returns:
- An InitialPosition instance.
-
-