Package dev.robocode.tankroyale.botapi
Class InitialPosition
- Object
-
- InitialPosition
-
public final class InitialPosition extends ObjectInitial 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 booleanequals(Object o)static InitialPositionfromString(String initialPosition)Creates a new instance of the InitialPosition class from a string.DoublegetDirection()Returns the shared direction of the body, gun, and radar;DoublegetX()Returns the x coordinate;DoublegetY()Returns the y coordinate;inthashCode()StringtoString()
-
-
-
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, wherenullmeans it is random.y- is the y coordinate, wherenullmeans it is random.direction- is the shared direction of the body, gun, and radar, wherenullmeans it is random.
-
-
Method Detail
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classObject
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject
-
getX
public Double getX()
Returns the x coordinate;- Returns:
- The x coordinate or
nullif 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
nullif 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
nullif no direction is specified and a random value must be used.
-
toString
public String toString()
- Overrides:
toStringin 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.
-
-