Class 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.
    • 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, where null means it is random.
        y - is the y coordinate, where null means it is random.
        direction - is the shared direction of the body, gun, and radar, where null means it is random.
    • Method Detail

      • equals

        public boolean equals​(Object o)
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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 class Object
      • 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.