'''Deep-copy a AsteroidPattern
:type self: AsteroidPattern
:rtype: AsteroidPattern
'''
result = _lib.bc_AsteroidPattern_clone(self._ptr)
_check_errors()
_result = AsteroidPattern.__new__(AsteroidPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a AsteroidPattern from a JSON string :type s: str :rtype: AsteroidPattern
@staticmethod
def from_json(s):
# type: (str) -> AsteroidPattern
'''Deserialize a AsteroidPattern from a JSON string
:type s: str
:rtype: AsteroidPattern
'''
result = _lib.bc_AsteroidPattern_from_json(_ffi.new("char[]", s))
_check_errors()
_result = AsteroidPattern.__new__(AsteroidPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def has_asteroid(
self, round)
Whether there is an asteroid strike at the given round. :type self: AsteroidPattern :type round: int :rtype: bool
def has_asteroid(self, round):
# type: (int) -> bool
'''Whether there is an asteroid strike at the given round.
:type self: AsteroidPattern
:type round: int
:rtype: bool
'''
result = _lib.bc_AsteroidPattern_has_asteroid(self._ptr, round)
_check_errors()
result = bool(result)
return result
def to_json(
self)
Serialize a AsteroidPattern to a JSON string :type self: AsteroidPattern :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a AsteroidPattern to a JSON string
:type self: AsteroidPattern
:rtype: str
'''
result = _lib.bc_AsteroidPattern_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def validate(
self)
Validates the asteroid pattern.
- InvalidMapObject - the asteroid pattern is invalid. :type self: AsteroidPattern :rtype: None
def validate(self):
# type: () -> None
'''Validates the asteroid pattern.
* InvalidMapObject - the asteroid pattern is invalid.
:type self: AsteroidPattern
:rtype: None
'''
result = _lib.bc_AsteroidPattern_validate(self._ptr)
_check_errors()
return result
class AsteroidStrike
class AsteroidStrike(object):
__slots__ = ['_ptr']
def __init__(self, karbonite, location):
# type: (int, MapLocation) -> AsteroidStrike
'''
:type self: AsteroidStrike
:type karbonite: int
:type location: MapLocation
:rtype: AsteroidStrike
'''
ptr = _lib.new_bc_AsteroidStrike(karbonite, location._ptr)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: AsteroidStrike
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_AsteroidStrike(self._ptr)
_check_errors()
@property
def karbonite(self):
# type: () -> int
'''
:type self: AsteroidStrike
:rtype: int
'''
result = _lib.bc_AsteroidStrike_karbonite_get(self._ptr)
_check_errors()
return result
@property
def location(self):
# type: () -> MapLocation
'''
:type self: AsteroidStrike
:rtype: MapLocation
'''
result = _lib.bc_AsteroidStrike_location_get(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@karbonite.setter
def karbonite(self, karbonite):
# type: (int) -> None
'''
:type self: AsteroidStrike
:type karbonite: int
:rtype: None
'''
result = _lib.bc_AsteroidStrike_karbonite_set(self._ptr, karbonite)
_check_errors()
return result
@location.setter
def location(self, location):
# type: (MapLocation) -> None
'''
:type self: AsteroidStrike
:type location: MapLocation
:rtype: None
'''
result = _lib.bc_AsteroidStrike_location_set(self._ptr, location._ptr)
_check_errors()
return result
def clone(self):
# type: () -> AsteroidStrike
'''Deep-copy a AsteroidStrike
:type self: AsteroidStrike
:rtype: AsteroidStrike
'''
result = _lib.bc_AsteroidStrike_clone(self._ptr)
_check_errors()
_result = AsteroidStrike.__new__(AsteroidStrike)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a AsteroidStrike
:type self: AsteroidStrike
:rtype: str
'''
result = _lib.bc_AsteroidStrike_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
@staticmethod
def from_json(s):
# type: (str) -> AsteroidStrike
'''Deserialize a AsteroidStrike from a JSON string
:type s: str
:rtype: AsteroidStrike
'''
result = _lib.bc_AsteroidStrike_from_json(_ffi.new("char[]", s))
_check_errors()
_result = AsteroidStrike.__new__(AsteroidStrike)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a AsteroidStrike to a JSON string
:type self: AsteroidStrike
:rtype: str
'''
result = _lib.bc_AsteroidStrike_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def __eq__(self, other):
# type: (AsteroidStrike) -> bool
'''Compare two AsteroidStrikes for deep equality.
:type self: AsteroidStrike
:type other: AsteroidStrike
:rtype: bool
'''
result = _lib.bc_AsteroidStrike_eq(self._ptr, other._ptr)
_check_errors()
result = bool(result)
return result
Ancestors (in MRO)
- AsteroidStrike
- builtins.object
Static methods
def __init__(
self, karbonite, location)
:type self: AsteroidStrike :type karbonite: int :type location: MapLocation :rtype: AsteroidStrike
def __init__(self, karbonite, location):
# type: (int, MapLocation) -> AsteroidStrike
'''
:type self: AsteroidStrike
:type karbonite: int
:type location: MapLocation
:rtype: AsteroidStrike
'''
ptr = _lib.new_bc_AsteroidStrike(karbonite, location._ptr)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a AsteroidStrike :type self: AsteroidStrike :rtype: AsteroidStrike
def clone(self):
# type: () -> AsteroidStrike
'''Deep-copy a AsteroidStrike
:type self: AsteroidStrike
:rtype: AsteroidStrike
'''
result = _lib.bc_AsteroidStrike_clone(self._ptr)
_check_errors()
_result = AsteroidStrike.__new__(AsteroidStrike)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a AsteroidStrike from a JSON string :type s: str :rtype: AsteroidStrike
@staticmethod
def from_json(s):
# type: (str) -> AsteroidStrike
'''Deserialize a AsteroidStrike from a JSON string
:type s: str
:rtype: AsteroidStrike
'''
result = _lib.bc_AsteroidStrike_from_json(_ffi.new("char[]", s))
_check_errors()
_result = AsteroidStrike.__new__(AsteroidStrike)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a AsteroidStrike to a JSON string :type self: AsteroidStrike :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a AsteroidStrike to a JSON string
:type self: AsteroidStrike
:rtype: str
'''
result = _lib.bc_AsteroidStrike_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Instance variables
var karbonite
:type self: AsteroidStrike :rtype: int
var location
:type self: AsteroidStrike :rtype: MapLocation
class Delta
class Delta(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> Delta
'''
:type self: Delta
:rtype: Delta
'''
ptr = _lib.new_bc_Delta()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: Delta
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_Delta(self._ptr)
_check_errors()
@staticmethod
def from_json(s):
# type: (str) -> Delta
'''Deserialize a Delta from a JSON string
:type s: str
:rtype: Delta
'''
result = _lib.bc_Delta_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Delta.__new__(Delta)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a Delta to a JSON string
:type self: Delta
:rtype: str
'''
result = _lib.bc_Delta_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- Delta
- builtins.object
Static methods
def __init__(
self)
:type self: Delta :rtype: Delta
def __init__(self):
# type: () -> Delta
'''
:type self: Delta
:rtype: Delta
'''
ptr = _lib.new_bc_Delta()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a Delta from a JSON string :type s: str :rtype: Delta
@staticmethod
def from_json(s):
# type: (str) -> Delta
'''Deserialize a Delta from a JSON string
:type s: str
:rtype: Delta
'''
result = _lib.bc_Delta_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Delta.__new__(Delta)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a Delta to a JSON string :type self: Delta :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a Delta to a JSON string
:type self: Delta
:rtype: str
'''
result = _lib.bc_Delta_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
class Direction
An enumeration.
class Direction(enum.IntEnum):
North = 0
Northeast = 1
East = 2
Southeast = 3
South = 4
Southwest = 5
West = 6
Northwest = 7
Center = 8
def dx(self):
# type: () -> int
'''Returns the x displacement of this direction.
:type self: Direction
:rtype: int
'''
result = _lib.bc_Direction_dx(self)
_check_errors()
return result
def dy(self):
# type: () -> int
'''Returns the y displacement of this direction.
:type self: Direction
:rtype: int
'''
result = _lib.bc_Direction_dy(self)
_check_errors()
return result
def is_diagonal(self):
# type: () -> bool
'''Whether this direction is a diagonal one.
:type self: Direction
:rtype: bool
'''
result = _lib.bc_Direction_is_diagonal(self)
_check_errors()
result = bool(result)
return result
def opposite(self):
# type: () -> Direction
'''Returns the direction opposite this one, or Center if it's Center.
:type self: Direction
:rtype: Direction
'''
result = _lib.bc_Direction_opposite(self)
_check_errors()
result = Direction(result)
return result
def rotate_left(self):
# type: () -> Direction
'''Returns the direction 45 degrees to the left (counter-clockwise) of
this one, or Center if it's Center.
:type self: Direction
:rtype: Direction
'''
result = _lib.bc_Direction_rotate_left(self)
_check_errors()
result = Direction(result)
return result
def rotate_right(self):
# type: () -> Direction
'''Returns the direction 45 degrees to the right (clockwise) of this one,
or Center if it's Center.
:type self: Direction
:rtype: Direction
'''
result = _lib.bc_Direction_rotate_right(self)
_check_errors()
result = Direction(result)
return result
@staticmethod
def from_json(s):
# type: (str) -> Direction
'''Deserialize a Direction from a JSON string
:type s: str
:rtype: Direction
'''
result = _lib.bc_Direction_from_json(_ffi.new("char[]", s))
_check_errors()
result = Direction(result)
return result
def to_json(self):
# type: () -> str
'''Serialize a Direction to a JSON string
:type self: Direction
:rtype: str
'''
result = _lib.bc_Direction_to_json(self)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- Direction
- enum.IntEnum
- builtins.int
- enum.Enum
- builtins.object
Class variables
var Center
var East
var North
var Northeast
var Northwest
var South
var Southeast
var Southwest
var West
class ErrorMessage
class ErrorMessage(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> ErrorMessage
'''
:type self: ErrorMessage
:rtype: ErrorMessage
'''
ptr = _lib.new_bc_ErrorMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: ErrorMessage
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_ErrorMessage(self._ptr)
_check_errors()
@property
def error(self):
# type: () -> str
'''
:type self: ErrorMessage
:rtype: str
'''
result = _lib.bc_ErrorMessage_error_get(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
@error.setter
def error(self, error):
# type: (str) -> None
'''
:type self: ErrorMessage
:type error: str
:rtype: None
'''
result = _lib.bc_ErrorMessage_error_set(self._ptr, _ffi.new("char[]", error))
_check_errors()
return result
@staticmethod
def from_json(s):
# type: (str) -> ErrorMessage
'''Deserialize a ErrorMessage from a JSON string
:type s: str
:rtype: ErrorMessage
'''
result = _lib.bc_ErrorMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ErrorMessage.__new__(ErrorMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a ErrorMessage to a JSON string
:type self: ErrorMessage
:rtype: str
'''
result = _lib.bc_ErrorMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a ErrorMessage
:type self: ErrorMessage
:rtype: str
'''
result = _lib.bc_ErrorMessage_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- ErrorMessage
- builtins.object
Static methods
def __init__(
self)
:type self: ErrorMessage :rtype: ErrorMessage
def __init__(self):
# type: () -> ErrorMessage
'''
:type self: ErrorMessage
:rtype: ErrorMessage
'''
ptr = _lib.new_bc_ErrorMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a ErrorMessage from a JSON string :type s: str :rtype: ErrorMessage
@staticmethod
def from_json(s):
# type: (str) -> ErrorMessage
'''Deserialize a ErrorMessage from a JSON string
:type s: str
:rtype: ErrorMessage
'''
result = _lib.bc_ErrorMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ErrorMessage.__new__(ErrorMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a ErrorMessage to a JSON string :type self: ErrorMessage :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a ErrorMessage to a JSON string
:type self: ErrorMessage
:rtype: str
'''
result = _lib.bc_ErrorMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Instance variables
var error
:type self: ErrorMessage :rtype: str
class GameController
class GameController(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> GameController
'''Use environment variables to connect to the manager.
:type self: GameController
:rtype: GameController
'''
ptr = _lib.new_bc_GameController()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: GameController
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_GameController(self._ptr)
_check_errors()
def next_turn(self):
# type: () -> None
'''Send the moves from the current turn and wait for the next turn.
:type self: GameController
:rtype: None
'''
result = _lib.bc_GameController_next_turn(self._ptr)
_check_errors()
return result
def round(self):
# type: () -> int
'''The current round, starting at round 1 and up to ROUND_LIMIT rounds. A round consists of a turn from each team on each planet.
:type self: GameController
:rtype: int
'''
result = _lib.bc_GameController_round(self._ptr)
_check_errors()
return result
def planet(self):
# type: () -> Planet
'''The current planet.
:type self: GameController
:rtype: Planet
'''
result = _lib.bc_GameController_planet(self._ptr)
_check_errors()
result = Planet(result)
return result
def team(self):
# type: () -> Team
'''The team whose turn it is.
:type self: GameController
:rtype: Team
'''
result = _lib.bc_GameController_team(self._ptr)
_check_errors()
result = Team(result)
return result
def starting_map(self, planet):
# type: (Planet) -> PlanetMap
'''The starting map of the given planet. Includes the map's planet, dimensions, impassable terrain, and initial units and karbonite.
:type self: GameController
:type planet: Planet
:rtype: PlanetMap
'''
result = _lib.bc_GameController_starting_map(self._ptr, planet)
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def karbonite(self):
# type: () -> int
'''The karbonite in the team's resource pool.
:type self: GameController
:rtype: int
'''
result = _lib.bc_GameController_karbonite(self._ptr)
_check_errors()
return result
def unit(self, id):
# type: (int) -> Unit
'''The single unit with this ID. Use this method to get detailed statistics on a unit - heat, cooldowns, and properties of special abilities like units garrisoned in a rocket.
* NoSuchUnit - the unit does not exist (inside the vision range).
:type self: GameController
:type id: int
:rtype: Unit
'''
result = _lib.bc_GameController_unit(self._ptr, id)
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def units(self):
# type: () -> VecUnit
'''All the units within the vision range, in no particular order. Does not include units in space.
:type self: GameController
:rtype: VecUnit
'''
result = _lib.bc_GameController_units(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def my_units(self):
# type: () -> VecUnit
'''All the units on your team. Does not include units in space.
:type self: GameController
:rtype: VecUnit
'''
result = _lib.bc_GameController_my_units(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def units_in_space(self):
# type: () -> VecUnit
'''All the units of this team that are in space. You cannot see units on the other team that are in space.
:type self: GameController
:rtype: VecUnit
'''
result = _lib.bc_GameController_units_in_space(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def karbonite_at(self, location):
# type: (MapLocation) -> int
'''The karbonite at the given location.
* LocationOffMap - the location is off the map.
* LocationNotVisible - the location is outside the vision range.
:type self: GameController
:type location: MapLocation
:rtype: int
'''
result = _lib.bc_GameController_karbonite_at(self._ptr, location._ptr)
_check_errors()
return result
def all_locations_within(self, location, radius_squared):
# type: (MapLocation, int) -> VecMapLocation
'''Returns an array of all locations within a certain radius squared of this location that are on the map.
The locations are ordered first by the x-coordinate, then the y-coordinate. The radius squared is inclusive.
:type self: GameController
:type location: MapLocation
:type radius_squared: int
:rtype: VecMapLocation
'''
result = _lib.bc_GameController_all_locations_within(self._ptr, location._ptr, radius_squared)
_check_errors()
_result = VecMapLocation.__new__(VecMapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def can_sense_location(self, location):
# type: (MapLocation) -> bool
'''Whether the location is on the map and within the vision range.
:type self: GameController
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_sense_location(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def can_sense_unit(self, id):
# type: (int) -> bool
'''Whether there is a unit with this ID within the vision range.
:type self: GameController
:type id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_sense_unit(self._ptr, id)
_check_errors()
result = bool(result)
return result
def sense_nearby_units(self, location, radius):
# type: (MapLocation, int) -> VecUnit
'''Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range.
:type self: GameController
:type location: MapLocation
:type radius: int
:rtype: VecUnit
'''
result = _lib.bc_GameController_sense_nearby_units(self._ptr, location._ptr, radius)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def sense_nearby_units_by_team(self, location, radius, team):
# type: (MapLocation, int, Team) -> VecUnit
'''Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range. Additionally filters the units by team.
:type self: GameController
:type location: MapLocation
:type radius: int
:type team: Team
:rtype: VecUnit
'''
result = _lib.bc_GameController_sense_nearby_units_by_team(self._ptr, location._ptr, radius, team)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def sense_nearby_units_by_type(self, location, radius, unit_type):
# type: (MapLocation, int, UnitType) -> VecUnit
'''Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range. Additionally filters the units by unit type.
:type self: GameController
:type location: MapLocation
:type radius: int
:type unit_type: UnitType
:rtype: VecUnit
'''
result = _lib.bc_GameController_sense_nearby_units_by_type(self._ptr, location._ptr, radius, unit_type)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def has_unit_at_location(self, location):
# type: (MapLocation) -> bool
'''Whether there is a visible unit at a location.
:type self: GameController
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_has_unit_at_location(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def sense_unit_at_location(self, location):
# type: (MapLocation) -> Unit
'''The unit at the location, if it exists.
* LocationOffMap - the location is off the map.
* LocationNotVisible - the location is outside the vision range.
:type self: GameController
:type location: MapLocation
:rtype: Unit
'''
result = _lib.bc_GameController_sense_unit_at_location(self._ptr, location._ptr)
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def asteroid_pattern(self):
# type: () -> AsteroidPattern
'''The asteroid strike pattern on Mars.
:type self: GameController
:rtype: AsteroidPattern
'''
result = _lib.bc_GameController_asteroid_pattern(self._ptr)
_check_errors()
_result = AsteroidPattern.__new__(AsteroidPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def orbit_pattern(self):
# type: () -> OrbitPattern
'''The orbit pattern that determines a rocket's flight duration.
:type self: GameController
:rtype: OrbitPattern
'''
result = _lib.bc_GameController_orbit_pattern(self._ptr)
_check_errors()
_result = OrbitPattern.__new__(OrbitPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def current_duration_of_flight(self):
# type: () -> int
'''The current duration of flight if a rocket were to be launched this round. Does not take into account any research done on rockets.
:type self: GameController
:rtype: int
'''
result = _lib.bc_GameController_current_duration_of_flight(self._ptr)
_check_errors()
return result
def get_team_array(self, planet):
# type: (Planet) -> Veci32
'''Gets a read-only version of this planet's team array. If the given planet is different from the planet of the player, reads the version of the planet's team array from COMMUNICATION_DELAY rounds prior.
:type self: GameController
:type planet: Planet
:rtype: Veci32
'''
result = _lib.bc_GameController_get_team_array(self._ptr, planet)
_check_errors()
_result = Veci32.__new__(Veci32)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def write_team_array(self, index, value):
# type: (int, int) -> None
'''Writes the value at the index of this planet's team array.
* ArrayOutOfBounds - the index of the array is out of bounds. It must be within [0, COMMUNICATION_ARRAY_LENGTH).
:type self: GameController
:type index: int
:type value: int
:rtype: None
'''
result = _lib.bc_GameController_write_team_array(self._ptr, index, value)
_check_errors()
return result
def disintegrate_unit(self, unit_id):
# type: (int) -> None
'''Disintegrates the unit and removes it from the map. If the unit is a factory or a rocket, also disintegrates any units garrisoned inside it.
* NoSuchUnit - the unit does not exist (inside the vision range).
* TeamNotAllowed - the unit is not on the current player's team.
:type self: GameController
:type unit_id: int
:rtype: None
'''
result = _lib.bc_GameController_disintegrate_unit(self._ptr, unit_id)
_check_errors()
return result
def is_occupiable(self, location):
# type: (MapLocation) -> bool
'''Whether the location is clear for a unit to occupy, either by movement or by construction.
* LocationOffMap - the location is off the map.
* LocationNotVisible - the location is outside the vision range.
:type self: GameController
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_is_occupiable(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def can_move(self, robot_id, direction):
# type: (int, Direction) -> bool
'''Whether the robot can move in the given direction, without taking into account the unit's movement heat. Takes into account only the map terrain, positions of other robots, and the edge of the game map.
:type self: GameController
:type robot_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_move(self._ptr, robot_id, direction)
_check_errors()
result = bool(result)
return result
def is_move_ready(self, robot_id):
# type: (int) -> bool
'''Whether the robot is ready to move. Tests whether the robot's attack heat is sufficiently low.
:type self: GameController
:type robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_move_ready(self._ptr, robot_id)
_check_errors()
result = bool(result)
return result
def move_robot(self, robot_id, direction):
# type: (int, Direction) -> None
'''Moves the robot in the given direction.
* NoSuchUnit - the robot does not exist (within the vision range).
* TeamNotAllowed - the robot is not on the current player's team.
* UnitNotOnMap - the robot is not on the map.
* LocationNotVisible - the location is outside the vision range.
* LocationOffMap - the location is off the map.
* LocationNotEmpty - the location is occupied by a unit or terrain.
* Overheated - the robot is not ready to move again.
:type self: GameController
:type robot_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_move_robot(self._ptr, robot_id, direction)
_check_errors()
return result
def can_attack(self, robot_id, target_unit_id):
# type: (int, int) -> bool
'''Whether the robot can attack the given unit, without taking into account the robot's attack heat. Takes into account only the robot's attack range, and the location of the robot and target.
Healers cannot attack, and should use can_heal() instead.
:type self: GameController
:type robot_id: int
:type target_unit_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_attack(self._ptr, robot_id, target_unit_id)
_check_errors()
result = bool(result)
return result
def is_attack_ready(self, robot_id):
# type: (int) -> bool
'''Whether the robot is ready to attack. Tests whether the robot's attack heat is sufficiently low.
Healers cannot attack, and should use is_heal_ready() instead.
:type self: GameController
:type robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_attack_ready(self._ptr, robot_id)
_check_errors()
result = bool(result)
return result
def attack(self, robot_id, target_unit_id):
# type: (int, int) -> None
'''Commands a robot to attack a unit, dealing the robot's standard amount of damage.
Healers cannot attack, and should use heal() instead.
* NoSuchUnit - the unit does not exist (inside the vision range).
* TeamNotAllowed - the unit is not on the current player's team.
* InappropriateUnitType - the unit is not a robot, or is a healer.
* UnitNotOnMap - the unit or target is not on the map.
* OutOfRange - the target location is not in range.
* Overheated - the unit is not ready to attack.
:type self: GameController
:type robot_id: int
:type target_unit_id: int
:rtype: None
'''
result = _lib.bc_GameController_attack(self._ptr, robot_id, target_unit_id)
_check_errors()
return result
def research_info(self):
# type: () -> ResearchInfo
'''The research info of the current team, including what branch is currently being researched, the number of rounds left.
:type self: GameController
:rtype: ResearchInfo
'''
result = _lib.bc_GameController_research_info(self._ptr)
_check_errors()
_result = ResearchInfo.__new__(ResearchInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def reset_research(self):
# type: () -> bool
'''Resets the research queue to be empty. Returns true if the queue was not empty before, and false otherwise.
:type self: GameController
:rtype: bool
'''
result = _lib.bc_GameController_reset_research(self._ptr)
_check_errors()
result = bool(result)
return result
def queue_research(self, branch):
# type: (UnitType) -> bool
'''Adds a branch to the back of the queue, if it is a valid upgrade, and starts research if it is the first in the queue.
Returns whether the branch was successfully added.
:type self: GameController
:type branch: UnitType
:rtype: bool
'''
result = _lib.bc_GameController_queue_research(self._ptr, branch)
_check_errors()
result = bool(result)
return result
def can_harvest(self, worker_id, direction):
# type: (int, Direction) -> bool
'''Whether the worker is ready to harvest, and the given direction contains karbonite to harvest. The worker cannot already have performed an action this round.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_harvest(self._ptr, worker_id, direction)
_check_errors()
result = bool(result)
return result
def harvest(self, worker_id, direction):
# type: (int, Direction) -> None
'''Harvests up to the worker's harvest amount of karbonite from the given location, adding it to the team's resource pool.
* NoSuchUnit - the worker does not exist (within the vision range).
* TeamNotAllowed - the worker is not on the current player's team.
* InappropriateUnitType - the unit is not a worker.
* Overheated - the worker has already performed an action this turn.
* UnitNotOnMap - the worker is not on the map.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotVisible - the location is not in the vision range.
* KarboniteDepositEmpty - the location described contains no Karbonite.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_harvest(self._ptr, worker_id, direction)
_check_errors()
return result
def can_blueprint(self, worker_id, unit_type, direction):
# type: (int, UnitType, Direction) -> bool
'''Whether the worker can blueprint a unit of the given type. The worker can only blueprint factories, and rockets if Rocketry has been researched. The team must have sufficient karbonite in its resource pool. The worker cannot already have performed an action this round.
:type self: GameController
:type worker_id: int
:type unit_type: UnitType
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_blueprint(self._ptr, worker_id, unit_type, direction)
_check_errors()
result = bool(result)
return result
def blueprint(self, worker_id, structure_type, direction):
# type: (int, UnitType, Direction) -> None
'''Blueprints a unit of the given type in the given direction. Subtract cost of that unit from the team's resource pool.
* NoSuchUnit - the worker does not exist (within the vision range).
* TeamNotAllowed - the worker is not on the current player's team.
* InappropriateUnitType - the unit is not a worker, or the unit type is not a structure.
* Overheated - the worker has already performed an action this turn.
* UnitNotOnMap - the unit is not on the map.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotVisible - the location is outside the vision range.
* LocationNotEmpty - the location in the target direction is already occupied.
* CannotBuildOnMars - you cannot blueprint a structure on Mars.
* ResearchNotUnlocked - you do not have the needed research to blueprint rockets.
* InsufficientKarbonite - your team does not have enough Karbonite to build the requested structure.
:type self: GameController
:type worker_id: int
:type structure_type: UnitType
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_blueprint(self._ptr, worker_id, structure_type, direction)
_check_errors()
return result
def can_build(self, worker_id, blueprint_id):
# type: (int, int) -> bool
'''Whether the worker can build a blueprint with the given ID. The worker and the blueprint must be adjacent to each other. The worker cannot already have performed an action this round.
:type self: GameController
:type worker_id: int
:type blueprint_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_build(self._ptr, worker_id, blueprint_id)
_check_errors()
result = bool(result)
return result
def build(self, worker_id, blueprint_id):
# type: (int, int) -> None
'''Builds a given blueprint, increasing its health by the worker's build amount. If raised to maximum health, the blueprint becomes a completed structure.
* NoSuchUnit - either unit does not exist (within the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - the worker is not on the map.
* InappropriateUnitType - the unit is not a worker, or the blueprint is not a structure.
* Overheated - the worker has already performed an action this turn.
* OutOfRange - the worker is not adjacent to the blueprint.
* StructureAlreadyBuilt - the blueprint has already been completed.
:type self: GameController
:type worker_id: int
:type blueprint_id: int
:rtype: None
'''
result = _lib.bc_GameController_build(self._ptr, worker_id, blueprint_id)
_check_errors()
return result
def can_repair(self, worker_id, structure_id):
# type: (int, int) -> bool
'''Whether the given worker can repair the given strucutre. Tests that the worker is able to execute a worker action, that the structure is built, and that the structure is within range.
:type self: GameController
:type worker_id: int
:type structure_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_repair(self._ptr, worker_id, structure_id)
_check_errors()
result = bool(result)
return result
def repair(self, worker_id, structure_id):
# type: (int, int) -> None
'''Commands the worker to repair a structure, repleneshing health to it. This can only be done to structures which have been fully built.
* NoSuchUnit - either unit does not exist (within the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - the worker is not on the map.
* InappropriateUnitType - the unit is not a worker, or the target is not a structure.
* Overheated - the worker has already performed an action this turn.
* OutOfRange - the worker is not adjacent to the structure.
* StructureNotYetBuilt - the structure has not been completed.
:type self: GameController
:type worker_id: int
:type structure_id: int
:rtype: None
'''
result = _lib.bc_GameController_repair(self._ptr, worker_id, structure_id)
_check_errors()
return result
def can_replicate(self, worker_id, direction):
# type: (int, Direction) -> bool
'''Whether the worker is ready to replicate. Tests that the worker's ability heat is sufficiently low, that the team has sufficient karbonite in its resource pool, and that the square in the given direction is empty.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_replicate(self._ptr, worker_id, direction)
_check_errors()
result = bool(result)
return result
def replicate(self, worker_id, direction):
# type: (int, Direction) -> None
'''Replicates a worker in the given direction. Subtracts the cost of the worker from the team's resource pool.
* NoSuchUnit - the worker does not exist (within the vision range).
* TeamNotAllowed - the worker is not on the current player's team.
* InappropriateUnitType - the unit is not a worker.
* Overheated - the worker is not ready to replicate again.
* InsufficientKarbonite - your team does not have enough Karbonite for the worker to replicate.
* UnitNotOnMap - the worker is not on the map.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotVisible - the location is outside the vision range.
* LocationNotEmpty - the location in the target direction is already occupied.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_replicate(self._ptr, worker_id, direction)
_check_errors()
return result
def can_javelin(self, knight_id, target_unit_id):
# type: (int, int) -> bool
'''Whether the knight can javelin the given robot, without taking into account the knight's ability heat. Takes into account only the knight's ability range, and the location of the robot.
:type self: GameController
:type knight_id: int
:type target_unit_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_javelin(self._ptr, knight_id, target_unit_id)
_check_errors()
result = bool(result)
return result
def is_javelin_ready(self, knight_id):
# type: (int) -> bool
'''Whether the knight is ready to javelin. Tests whether the knight's ability heat is sufficiently low.
:type self: GameController
:type knight_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_javelin_ready(self._ptr, knight_id)
_check_errors()
result = bool(result)
return result
def javelin(self, knight_id, target_unit_id):
# type: (int, int) -> None
'''Javelins the robot, dealing the knight's standard damage.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - the knight is not on the current player's team.
* UnitNotOnMap - the knight is not on the map.
* InappropriateUnitType - the unit is not a knight.
* ResearchNotUnlocked - you do not have the needed research to use javelin.
* OutOfRange - the target does not lie within ability range of the knight.
* Overheated - the knight is not ready to use javelin again.
:type self: GameController
:type knight_id: int
:type target_unit_id: int
:rtype: None
'''
result = _lib.bc_GameController_javelin(self._ptr, knight_id, target_unit_id)
_check_errors()
return result
def can_begin_snipe(self, ranger_id, location):
# type: (int, MapLocation) -> bool
'''Whether the ranger can begin to snipe the given location, without taking into account the ranger's ability heat. Takes into account only the target location and the unit's type and unlocked abilities.
:type self: GameController
:type ranger_id: int
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_begin_snipe(self._ptr, ranger_id, location._ptr)
_check_errors()
result = bool(result)
return result
def is_begin_snipe_ready(self, ranger_id):
# type: (int) -> bool
'''Whether the ranger is ready to begin snipe. Tests whether the ranger's ability heat is sufficiently low.
:type self: GameController
:type ranger_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_begin_snipe_ready(self._ptr, ranger_id)
_check_errors()
result = bool(result)
return result
def begin_snipe(self, ranger_id, location):
# type: (int, MapLocation) -> None
'''Begins the countdown to snipe a given location. Maximizes the units attack and movement heats until the ranger has sniped. The ranger may begin the countdown at any time, including resetting the countdown to snipe a different location.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - the ranger is not on the current player's team.
* UnitNotOnMap - the ranger is not on the map.
* InappropriateUnitType - the unit is not a ranger.
* ResearchNotUnlocked - you do not have the needed research to use snipe.
* Overheated - the ranger is not ready to use snipe again.
:type self: GameController
:type ranger_id: int
:type location: MapLocation
:rtype: None
'''
result = _lib.bc_GameController_begin_snipe(self._ptr, ranger_id, location._ptr)
_check_errors()
return result
def can_blink(self, mage_id, location):
# type: (int, MapLocation) -> bool
'''Whether the mage can blink to the given location, without taking into account the mage's ability heat. Takes into account only the mage's ability range, the map terrain, positions of other units, and the edge of the game map.
:type self: GameController
:type mage_id: int
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_blink(self._ptr, mage_id, location._ptr)
_check_errors()
result = bool(result)
return result
def is_blink_ready(self, mage_id):
# type: (int) -> bool
'''Whether the mage is ready to blink. Tests whether the mage's ability heat is sufficiently low.
:type self: GameController
:type mage_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_blink_ready(self._ptr, mage_id)
_check_errors()
result = bool(result)
return result
def blink(self, mage_id, location):
# type: (int, MapLocation) -> None
'''Blinks the mage to the given location.
* NoSuchUnit - the mage does not exist (inside the vision range).
* TeamNotAllowed - the mage is not on the current player's team.
* UnitNotOnMap - the mage is not on the map.
* InappropriateUnitType - the unit is not a mage.
* ResearchNotUnlocked - you do not have the needed research to use blink.
* OutOfRange - the target does not lie within ability range of the mage.
* LocationOffMap - the target location is not on this planet's map.
* LocationNotVisible - the target location is outside the vision range.
* LocationNotEmpty - the target location is already occupied.
* Overheated - the mage is not ready to use blink again.
:type self: GameController
:type mage_id: int
:type location: MapLocation
:rtype: None
'''
result = _lib.bc_GameController_blink(self._ptr, mage_id, location._ptr)
_check_errors()
return result
def can_heal(self, healer_id, target_robot_id):
# type: (int, int) -> bool
'''Whether the healer can heal the given robot, without taking into account the healer's attack heat. Takes into account only the healer's attack range, and the location of the robot.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_heal(self._ptr, healer_id, target_robot_id)
_check_errors()
result = bool(result)
return result
def is_heal_ready(self, healer_id):
# type: (int) -> bool
'''Whether the healer is ready to heal. Tests whether the healer's attack heat is sufficiently low.
:type self: GameController
:type healer_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_heal_ready(self._ptr, healer_id)
_check_errors()
result = bool(result)
return result
def heal(self, healer_id, target_robot_id):
# type: (int, int) -> None
'''Commands the healer to heal the target robot.
* NoSuchUnit - either unit does not exist (inside the vision range).
* InappropriateUnitType - the unit is not a healer, or the target is not a robot.
* TeamNotAllowed - either robot is not on the current player's team.
* UnitNotOnMap - the healer is not on the map.
* OutOfRange - the target does not lie within "attack" range of the healer.
* Overheated - the healer is not ready to heal again.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: None
'''
result = _lib.bc_GameController_heal(self._ptr, healer_id, target_robot_id)
_check_errors()
return result
def can_overcharge(self, healer_id, target_robot_id):
# type: (int, int) -> bool
'''Whether the healer can overcharge the given robot, without taking into account the healer's ability heat. Takes into account only the healer's ability range, and the location of the robot.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_overcharge(self._ptr, healer_id, target_robot_id)
_check_errors()
result = bool(result)
return result
def is_overcharge_ready(self, healer_id):
# type: (int) -> bool
'''Whether the healer is ready to overcharge. Tests whether the healer's ability heat is sufficiently low.
:type self: GameController
:type healer_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_overcharge_ready(self._ptr, healer_id)
_check_errors()
result = bool(result)
return result
def overcharge(self, healer_id, target_robot_id):
# type: (int, int) -> None
'''Overcharges the robot, resetting the robot's cooldowns. The robot must be on the same team as you.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - either robot is not on the current player's team.
* UnitNotOnMap - the healer is not on the map.
* InappropriateUnitType - the unit is not a healer, or the target is not a robot.
* ResearchNotUnlocked - you do not have the needed research to use overcharge.
* OutOfRange - the target does not lie within ability range of the healer.
* Overheated - the healer is not ready to use overcharge again.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: None
'''
result = _lib.bc_GameController_overcharge(self._ptr, healer_id, target_robot_id)
_check_errors()
return result
def can_load(self, structure_id, robot_id):
# type: (int, int) -> bool
'''Whether the robot can be loaded into the given structure's garrison. The robot must be ready to move and must be adjacent to the structure. The structure and the robot must be on the same team, and the structure must have space.
:type self: GameController
:type structure_id: int
:type robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_load(self._ptr, structure_id, robot_id)
_check_errors()
result = bool(result)
return result
def load(self, structure_id, robot_id):
# type: (int, int) -> None
'''Loads the robot into the garrison of the structure.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - either unit is not on the map.
* Overheated - the robot is not ready to move again.
* InappropriateUnitType - the first unit is not a structure, or the second unit is not a robot.
* StructureNotYetBuilt - the structure has not yet been completed.
* GarrisonFull - the structure's garrison is already full.
* OutOfRange - the robot is not adjacent to the structure.
:type self: GameController
:type structure_id: int
:type robot_id: int
:rtype: None
'''
result = _lib.bc_GameController_load(self._ptr, structure_id, robot_id)
_check_errors()
return result
def can_unload(self, structure_id, direction):
# type: (int, Direction) -> bool
'''Tests whether the given structure is able to unload a unit in the given direction. There must be space in that direction, and the unit must be ready to move.
:type self: GameController
:type structure_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_unload(self._ptr, structure_id, direction)
_check_errors()
result = bool(result)
return result
def unload(self, structure_id, direction):
# type: (int, Direction) -> None
'''Unloads a robot from the garrison of the specified structure into an adjacent space. Robots are unloaded in the order they were loaded.
* NoSuchUnit - the unit does not exist (inside the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - the structure is not on the map.
* InappropriateUnitType - the unit is not a structure.
* StructureNotYetBuilt - the structure has not yet been completed.
* GarrisonEmpty - the structure's garrison is already empty.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotEmpty - the location in the target direction is already occupied.
* Overheated - the robot inside the structure is not ready to move again.
:type self: GameController
:type structure_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_unload(self._ptr, structure_id, direction)
_check_errors()
return result
def can_produce_robot(self, factory_id, robot_type):
# type: (int, UnitType) -> bool
'''Whether the factory can produce a robot of the given type. The factory must not currently be producing a robot, and the team must have sufficient resources in its resource pool.
:type self: GameController
:type factory_id: int
:type robot_type: UnitType
:rtype: bool
'''
result = _lib.bc_GameController_can_produce_robot(self._ptr, factory_id, robot_type)
_check_errors()
result = bool(result)
return result
def produce_robot(self, factory_id, robot_type):
# type: (int, UnitType) -> None
'''Starts producing the robot of the given type.
* NoSuchUnit - the factory does not exist (inside the vision range).
* TeamNotAllowed - the factory is not on the current player's team.
* InappropriateUnitType - the unit is not a factory, or the unit type is not a robot.
* StructureNotYetBuilt - the factory has not yet been completed.
* FactoryBusy - the factory is already producing a unit.
* InsufficientKarbonite - your team does not have enough Karbonite to produce the given robot.
:type self: GameController
:type factory_id: int
:type robot_type: UnitType
:rtype: None
'''
result = _lib.bc_GameController_produce_robot(self._ptr, factory_id, robot_type)
_check_errors()
return result
def rocket_landings(self):
# type: () -> RocketLandingInfo
'''The landing rounds and locations of rockets in space that belong to the current team.
:type self: GameController
:rtype: RocketLandingInfo
'''
result = _lib.bc_GameController_rocket_landings(self._ptr)
_check_errors()
_result = RocketLandingInfo.__new__(RocketLandingInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def can_launch_rocket(self, rocket_id, destination):
# type: (int, MapLocation) -> bool
'''Whether the rocket can launch into space to the given destination. The rocket can launch if the it has never been used before. The destination is valid if it contains passable terrain on the other planet.
:type self: GameController
:type rocket_id: int
:type destination: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_launch_rocket(self._ptr, rocket_id, destination._ptr)
_check_errors()
result = bool(result)
return result
def launch_rocket(self, rocket_id, location):
# type: (int, MapLocation) -> None
'''Launches the rocket into space, damaging the units adjacent to the takeoff location.
* NoSuchUnit - the rocket does not exist (inside the vision range).
* TeamNotAllowed - the rocket is not on the current player's team.
* SamePlanet - the rocket cannot fly to a location on the same planet.
* InappropriateUnitType - the unit is not a rocket.
* StructureNotYetBuilt - the rocket has not yet been completed.
* RocketUsed - the rocket has already been used.
* LocationOffMap - the given location is off the map.
* LocationNotEmpty - the given location contains impassable terrain.
:type self: GameController
:type rocket_id: int
:type location: MapLocation
:rtype: None
'''
result = _lib.bc_GameController_launch_rocket(self._ptr, rocket_id, location._ptr)
_check_errors()
return result
@staticmethod
def new_manager(map):
# type: (GameMap) -> GameController
'''
:type map: GameMap
:rtype: GameController
'''
result = _lib.bc_GameController_new_manager(map._ptr)
_check_errors()
_result = GameController.__new__(GameController)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def start_game(self, player):
# type: (Player) -> StartGameMessage
'''
:type self: GameController
:type player: Player
:rtype: StartGameMessage
'''
result = _lib.bc_GameController_start_game(self._ptr, player._ptr)
_check_errors()
_result = StartGameMessage.__new__(StartGameMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def apply_turn(self, turn):
# type: (TurnMessage) -> TurnApplication
'''
:type self: GameController
:type turn: TurnMessage
:rtype: TurnApplication
'''
result = _lib.bc_GameController_apply_turn(self._ptr, turn._ptr)
_check_errors()
_result = TurnApplication.__new__(TurnApplication)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def initial_start_turn_message(self):
# type: () -> InitialTurnApplication
'''
:type self: GameController
:rtype: InitialTurnApplication
'''
result = _lib.bc_GameController_initial_start_turn_message(self._ptr)
_check_errors()
_result = InitialTurnApplication.__new__(InitialTurnApplication)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def is_over(self):
# type: () -> bool
'''
:type self: GameController
:rtype: bool
'''
result = _lib.bc_GameController_is_over(self._ptr)
_check_errors()
result = bool(result)
return result
def winning_team(self):
# type: () -> Team
'''
:type self: GameController
:rtype: Team
'''
result = _lib.bc_GameController_winning_team(self._ptr)
_check_errors()
result = Team(result)
return result
Ancestors (in MRO)
- GameController
- builtins.object
Static methods
def __init__(
self)
Use environment variables to connect to the manager. :type self: GameController :rtype: GameController
def __init__(self):
# type: () -> GameController
'''Use environment variables to connect to the manager.
:type self: GameController
:rtype: GameController
'''
ptr = _lib.new_bc_GameController()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def all_locations_within(
self, location, radius_squared)
Returns an array of all locations within a certain radius squared of this location that are on the map.
The locations are ordered first by the x-coordinate, then the y-coordinate. The radius squared is inclusive. :type self: GameController :type location: MapLocation :type radius_squared: int :rtype: VecMapLocation
def all_locations_within(self, location, radius_squared):
# type: (MapLocation, int) -> VecMapLocation
'''Returns an array of all locations within a certain radius squared of this location that are on the map.
The locations are ordered first by the x-coordinate, then the y-coordinate. The radius squared is inclusive.
:type self: GameController
:type location: MapLocation
:type radius_squared: int
:rtype: VecMapLocation
'''
result = _lib.bc_GameController_all_locations_within(self._ptr, location._ptr, radius_squared)
_check_errors()
_result = VecMapLocation.__new__(VecMapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def apply_turn(
self, turn)
:type self: GameController :type turn: TurnMessage :rtype: TurnApplication
def apply_turn(self, turn):
# type: (TurnMessage) -> TurnApplication
'''
:type self: GameController
:type turn: TurnMessage
:rtype: TurnApplication
'''
result = _lib.bc_GameController_apply_turn(self._ptr, turn._ptr)
_check_errors()
_result = TurnApplication.__new__(TurnApplication)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def asteroid_pattern(
self)
The asteroid strike pattern on Mars. :type self: GameController :rtype: AsteroidPattern
def asteroid_pattern(self):
# type: () -> AsteroidPattern
'''The asteroid strike pattern on Mars.
:type self: GameController
:rtype: AsteroidPattern
'''
result = _lib.bc_GameController_asteroid_pattern(self._ptr)
_check_errors()
_result = AsteroidPattern.__new__(AsteroidPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def attack(
self, robot_id, target_unit_id)
Commands a robot to attack a unit, dealing the robot's standard amount of damage.
Healers cannot attack, and should use heal() instead.
- NoSuchUnit - the unit does not exist (inside the vision range).
- TeamNotAllowed - the unit is not on the current player's team.
- InappropriateUnitType - the unit is not a robot, or is a healer.
- UnitNotOnMap - the unit or target is not on the map.
- OutOfRange - the target location is not in range.
- Overheated - the unit is not ready to attack. :type self: GameController :type robot_id: int :type target_unit_id: int :rtype: None
def attack(self, robot_id, target_unit_id):
# type: (int, int) -> None
'''Commands a robot to attack a unit, dealing the robot's standard amount of damage.
Healers cannot attack, and should use heal() instead.
* NoSuchUnit - the unit does not exist (inside the vision range).
* TeamNotAllowed - the unit is not on the current player's team.
* InappropriateUnitType - the unit is not a robot, or is a healer.
* UnitNotOnMap - the unit or target is not on the map.
* OutOfRange - the target location is not in range.
* Overheated - the unit is not ready to attack.
:type self: GameController
:type robot_id: int
:type target_unit_id: int
:rtype: None
'''
result = _lib.bc_GameController_attack(self._ptr, robot_id, target_unit_id)
_check_errors()
return result
def begin_snipe(
self, ranger_id, location)
Begins the countdown to snipe a given location. Maximizes the units attack and movement heats until the ranger has sniped. The ranger may begin the countdown at any time, including resetting the countdown to snipe a different location.
- NoSuchUnit - either unit does not exist (inside the vision range).
- TeamNotAllowed - the ranger is not on the current player's team.
- UnitNotOnMap - the ranger is not on the map.
- InappropriateUnitType - the unit is not a ranger.
- ResearchNotUnlocked - you do not have the needed research to use snipe.
- Overheated - the ranger is not ready to use snipe again. :type self: GameController :type ranger_id: int :type location: MapLocation :rtype: None
def begin_snipe(self, ranger_id, location):
# type: (int, MapLocation) -> None
'''Begins the countdown to snipe a given location. Maximizes the units attack and movement heats until the ranger has sniped. The ranger may begin the countdown at any time, including resetting the countdown to snipe a different location.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - the ranger is not on the current player's team.
* UnitNotOnMap - the ranger is not on the map.
* InappropriateUnitType - the unit is not a ranger.
* ResearchNotUnlocked - you do not have the needed research to use snipe.
* Overheated - the ranger is not ready to use snipe again.
:type self: GameController
:type ranger_id: int
:type location: MapLocation
:rtype: None
'''
result = _lib.bc_GameController_begin_snipe(self._ptr, ranger_id, location._ptr)
_check_errors()
return result
def blink(
self, mage_id, location)
Blinks the mage to the given location.
- NoSuchUnit - the mage does not exist (inside the vision range).
- TeamNotAllowed - the mage is not on the current player's team.
- UnitNotOnMap - the mage is not on the map.
- InappropriateUnitType - the unit is not a mage.
- ResearchNotUnlocked - you do not have the needed research to use blink.
- OutOfRange - the target does not lie within ability range of the mage.
- LocationOffMap - the target location is not on this planet's map.
- LocationNotVisible - the target location is outside the vision range.
- LocationNotEmpty - the target location is already occupied.
- Overheated - the mage is not ready to use blink again. :type self: GameController :type mage_id: int :type location: MapLocation :rtype: None
def blink(self, mage_id, location):
# type: (int, MapLocation) -> None
'''Blinks the mage to the given location.
* NoSuchUnit - the mage does not exist (inside the vision range).
* TeamNotAllowed - the mage is not on the current player's team.
* UnitNotOnMap - the mage is not on the map.
* InappropriateUnitType - the unit is not a mage.
* ResearchNotUnlocked - you do not have the needed research to use blink.
* OutOfRange - the target does not lie within ability range of the mage.
* LocationOffMap - the target location is not on this planet's map.
* LocationNotVisible - the target location is outside the vision range.
* LocationNotEmpty - the target location is already occupied.
* Overheated - the mage is not ready to use blink again.
:type self: GameController
:type mage_id: int
:type location: MapLocation
:rtype: None
'''
result = _lib.bc_GameController_blink(self._ptr, mage_id, location._ptr)
_check_errors()
return result
def blueprint(
self, worker_id, structure_type, direction)
Blueprints a unit of the given type in the given direction. Subtract cost of that unit from the team's resource pool.
- NoSuchUnit - the worker does not exist (within the vision range).
- TeamNotAllowed - the worker is not on the current player's team.
- InappropriateUnitType - the unit is not a worker, or the unit type is not a structure.
- Overheated - the worker has already performed an action this turn.
- UnitNotOnMap - the unit is not on the map.
- LocationOffMap - the location in the target direction is off the map.
- LocationNotVisible - the location is outside the vision range.
- LocationNotEmpty - the location in the target direction is already occupied.
- CannotBuildOnMars - you cannot blueprint a structure on Mars.
- ResearchNotUnlocked - you do not have the needed research to blueprint rockets.
- InsufficientKarbonite - your team does not have enough Karbonite to build the requested structure. :type self: GameController :type worker_id: int :type structure_type: UnitType :type direction: Direction :rtype: None
def blueprint(self, worker_id, structure_type, direction):
# type: (int, UnitType, Direction) -> None
'''Blueprints a unit of the given type in the given direction. Subtract cost of that unit from the team's resource pool.
* NoSuchUnit - the worker does not exist (within the vision range).
* TeamNotAllowed - the worker is not on the current player's team.
* InappropriateUnitType - the unit is not a worker, or the unit type is not a structure.
* Overheated - the worker has already performed an action this turn.
* UnitNotOnMap - the unit is not on the map.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotVisible - the location is outside the vision range.
* LocationNotEmpty - the location in the target direction is already occupied.
* CannotBuildOnMars - you cannot blueprint a structure on Mars.
* ResearchNotUnlocked - you do not have the needed research to blueprint rockets.
* InsufficientKarbonite - your team does not have enough Karbonite to build the requested structure.
:type self: GameController
:type worker_id: int
:type structure_type: UnitType
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_blueprint(self._ptr, worker_id, structure_type, direction)
_check_errors()
return result
def build(
self, worker_id, blueprint_id)
Builds a given blueprint, increasing its health by the worker's build amount. If raised to maximum health, the blueprint becomes a completed structure.
- NoSuchUnit - either unit does not exist (within the vision range).
- TeamNotAllowed - either unit is not on the current player's team.
- UnitNotOnMap - the worker is not on the map.
- InappropriateUnitType - the unit is not a worker, or the blueprint is not a structure.
- Overheated - the worker has already performed an action this turn.
- OutOfRange - the worker is not adjacent to the blueprint.
- StructureAlreadyBuilt - the blueprint has already been completed. :type self: GameController :type worker_id: int :type blueprint_id: int :rtype: None
def build(self, worker_id, blueprint_id):
# type: (int, int) -> None
'''Builds a given blueprint, increasing its health by the worker's build amount. If raised to maximum health, the blueprint becomes a completed structure.
* NoSuchUnit - either unit does not exist (within the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - the worker is not on the map.
* InappropriateUnitType - the unit is not a worker, or the blueprint is not a structure.
* Overheated - the worker has already performed an action this turn.
* OutOfRange - the worker is not adjacent to the blueprint.
* StructureAlreadyBuilt - the blueprint has already been completed.
:type self: GameController
:type worker_id: int
:type blueprint_id: int
:rtype: None
'''
result = _lib.bc_GameController_build(self._ptr, worker_id, blueprint_id)
_check_errors()
return result
def can_attack(
self, robot_id, target_unit_id)
Whether the robot can attack the given unit, without taking into account the robot's attack heat. Takes into account only the robot's attack range, and the location of the robot and target.
Healers cannot attack, and should use can_heal() instead. :type self: GameController :type robot_id: int :type target_unit_id: int :rtype: bool
def can_attack(self, robot_id, target_unit_id):
# type: (int, int) -> bool
'''Whether the robot can attack the given unit, without taking into account the robot's attack heat. Takes into account only the robot's attack range, and the location of the robot and target.
Healers cannot attack, and should use can_heal() instead.
:type self: GameController
:type robot_id: int
:type target_unit_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_attack(self._ptr, robot_id, target_unit_id)
_check_errors()
result = bool(result)
return result
def can_begin_snipe(
self, ranger_id, location)
Whether the ranger can begin to snipe the given location, without taking into account the ranger's ability heat. Takes into account only the target location and the unit's type and unlocked abilities. :type self: GameController :type ranger_id: int :type location: MapLocation :rtype: bool
def can_begin_snipe(self, ranger_id, location):
# type: (int, MapLocation) -> bool
'''Whether the ranger can begin to snipe the given location, without taking into account the ranger's ability heat. Takes into account only the target location and the unit's type and unlocked abilities.
:type self: GameController
:type ranger_id: int
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_begin_snipe(self._ptr, ranger_id, location._ptr)
_check_errors()
result = bool(result)
return result
def can_blink(
self, mage_id, location)
Whether the mage can blink to the given location, without taking into account the mage's ability heat. Takes into account only the mage's ability range, the map terrain, positions of other units, and the edge of the game map. :type self: GameController :type mage_id: int :type location: MapLocation :rtype: bool
def can_blink(self, mage_id, location):
# type: (int, MapLocation) -> bool
'''Whether the mage can blink to the given location, without taking into account the mage's ability heat. Takes into account only the mage's ability range, the map terrain, positions of other units, and the edge of the game map.
:type self: GameController
:type mage_id: int
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_blink(self._ptr, mage_id, location._ptr)
_check_errors()
result = bool(result)
return result
def can_blueprint(
self, worker_id, unit_type, direction)
Whether the worker can blueprint a unit of the given type. The worker can only blueprint factories, and rockets if Rocketry has been researched. The team must have sufficient karbonite in its resource pool. The worker cannot already have performed an action this round. :type self: GameController :type worker_id: int :type unit_type: UnitType :type direction: Direction :rtype: bool
def can_blueprint(self, worker_id, unit_type, direction):
# type: (int, UnitType, Direction) -> bool
'''Whether the worker can blueprint a unit of the given type. The worker can only blueprint factories, and rockets if Rocketry has been researched. The team must have sufficient karbonite in its resource pool. The worker cannot already have performed an action this round.
:type self: GameController
:type worker_id: int
:type unit_type: UnitType
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_blueprint(self._ptr, worker_id, unit_type, direction)
_check_errors()
result = bool(result)
return result
def can_build(
self, worker_id, blueprint_id)
Whether the worker can build a blueprint with the given ID. The worker and the blueprint must be adjacent to each other. The worker cannot already have performed an action this round. :type self: GameController :type worker_id: int :type blueprint_id: int :rtype: bool
def can_build(self, worker_id, blueprint_id):
# type: (int, int) -> bool
'''Whether the worker can build a blueprint with the given ID. The worker and the blueprint must be adjacent to each other. The worker cannot already have performed an action this round.
:type self: GameController
:type worker_id: int
:type blueprint_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_build(self._ptr, worker_id, blueprint_id)
_check_errors()
result = bool(result)
return result
def can_harvest(
self, worker_id, direction)
Whether the worker is ready to harvest, and the given direction contains karbonite to harvest. The worker cannot already have performed an action this round. :type self: GameController :type worker_id: int :type direction: Direction :rtype: bool
def can_harvest(self, worker_id, direction):
# type: (int, Direction) -> bool
'''Whether the worker is ready to harvest, and the given direction contains karbonite to harvest. The worker cannot already have performed an action this round.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_harvest(self._ptr, worker_id, direction)
_check_errors()
result = bool(result)
return result
def can_heal(
self, healer_id, target_robot_id)
Whether the healer can heal the given robot, without taking into account the healer's attack heat. Takes into account only the healer's attack range, and the location of the robot. :type self: GameController :type healer_id: int :type target_robot_id: int :rtype: bool
def can_heal(self, healer_id, target_robot_id):
# type: (int, int) -> bool
'''Whether the healer can heal the given robot, without taking into account the healer's attack heat. Takes into account only the healer's attack range, and the location of the robot.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_heal(self._ptr, healer_id, target_robot_id)
_check_errors()
result = bool(result)
return result
def can_javelin(
self, knight_id, target_unit_id)
Whether the knight can javelin the given robot, without taking into account the knight's ability heat. Takes into account only the knight's ability range, and the location of the robot. :type self: GameController :type knight_id: int :type target_unit_id: int :rtype: bool
def can_javelin(self, knight_id, target_unit_id):
# type: (int, int) -> bool
'''Whether the knight can javelin the given robot, without taking into account the knight's ability heat. Takes into account only the knight's ability range, and the location of the robot.
:type self: GameController
:type knight_id: int
:type target_unit_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_javelin(self._ptr, knight_id, target_unit_id)
_check_errors()
result = bool(result)
return result
def can_launch_rocket(
self, rocket_id, destination)
Whether the rocket can launch into space to the given destination. The rocket can launch if the it has never been used before. The destination is valid if it contains passable terrain on the other planet. :type self: GameController :type rocket_id: int :type destination: MapLocation :rtype: bool
def can_launch_rocket(self, rocket_id, destination):
# type: (int, MapLocation) -> bool
'''Whether the rocket can launch into space to the given destination. The rocket can launch if the it has never been used before. The destination is valid if it contains passable terrain on the other planet.
:type self: GameController
:type rocket_id: int
:type destination: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_launch_rocket(self._ptr, rocket_id, destination._ptr)
_check_errors()
result = bool(result)
return result
def can_load(
self, structure_id, robot_id)
Whether the robot can be loaded into the given structure's garrison. The robot must be ready to move and must be adjacent to the structure. The structure and the robot must be on the same team, and the structure must have space. :type self: GameController :type structure_id: int :type robot_id: int :rtype: bool
def can_load(self, structure_id, robot_id):
# type: (int, int) -> bool
'''Whether the robot can be loaded into the given structure's garrison. The robot must be ready to move and must be adjacent to the structure. The structure and the robot must be on the same team, and the structure must have space.
:type self: GameController
:type structure_id: int
:type robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_load(self._ptr, structure_id, robot_id)
_check_errors()
result = bool(result)
return result
def can_move(
self, robot_id, direction)
Whether the robot can move in the given direction, without taking into account the unit's movement heat. Takes into account only the map terrain, positions of other robots, and the edge of the game map. :type self: GameController :type robot_id: int :type direction: Direction :rtype: bool
def can_move(self, robot_id, direction):
# type: (int, Direction) -> bool
'''Whether the robot can move in the given direction, without taking into account the unit's movement heat. Takes into account only the map terrain, positions of other robots, and the edge of the game map.
:type self: GameController
:type robot_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_move(self._ptr, robot_id, direction)
_check_errors()
result = bool(result)
return result
def can_overcharge(
self, healer_id, target_robot_id)
Whether the healer can overcharge the given robot, without taking into account the healer's ability heat. Takes into account only the healer's ability range, and the location of the robot. :type self: GameController :type healer_id: int :type target_robot_id: int :rtype: bool
def can_overcharge(self, healer_id, target_robot_id):
# type: (int, int) -> bool
'''Whether the healer can overcharge the given robot, without taking into account the healer's ability heat. Takes into account only the healer's ability range, and the location of the robot.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_overcharge(self._ptr, healer_id, target_robot_id)
_check_errors()
result = bool(result)
return result
def can_produce_robot(
self, factory_id, robot_type)
Whether the factory can produce a robot of the given type. The factory must not currently be producing a robot, and the team must have sufficient resources in its resource pool. :type self: GameController :type factory_id: int :type robot_type: UnitType :rtype: bool
def can_produce_robot(self, factory_id, robot_type):
# type: (int, UnitType) -> bool
'''Whether the factory can produce a robot of the given type. The factory must not currently be producing a robot, and the team must have sufficient resources in its resource pool.
:type self: GameController
:type factory_id: int
:type robot_type: UnitType
:rtype: bool
'''
result = _lib.bc_GameController_can_produce_robot(self._ptr, factory_id, robot_type)
_check_errors()
result = bool(result)
return result
def can_repair(
self, worker_id, structure_id)
Whether the given worker can repair the given strucutre. Tests that the worker is able to execute a worker action, that the structure is built, and that the structure is within range. :type self: GameController :type worker_id: int :type structure_id: int :rtype: bool
def can_repair(self, worker_id, structure_id):
# type: (int, int) -> bool
'''Whether the given worker can repair the given strucutre. Tests that the worker is able to execute a worker action, that the structure is built, and that the structure is within range.
:type self: GameController
:type worker_id: int
:type structure_id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_repair(self._ptr, worker_id, structure_id)
_check_errors()
result = bool(result)
return result
def can_replicate(
self, worker_id, direction)
Whether the worker is ready to replicate. Tests that the worker's ability heat is sufficiently low, that the team has sufficient karbonite in its resource pool, and that the square in the given direction is empty. :type self: GameController :type worker_id: int :type direction: Direction :rtype: bool
def can_replicate(self, worker_id, direction):
# type: (int, Direction) -> bool
'''Whether the worker is ready to replicate. Tests that the worker's ability heat is sufficiently low, that the team has sufficient karbonite in its resource pool, and that the square in the given direction is empty.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_replicate(self._ptr, worker_id, direction)
_check_errors()
result = bool(result)
return result
def can_sense_location(
self, location)
Whether the location is on the map and within the vision range. :type self: GameController :type location: MapLocation :rtype: bool
def can_sense_location(self, location):
# type: (MapLocation) -> bool
'''Whether the location is on the map and within the vision range.
:type self: GameController
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_can_sense_location(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def can_sense_unit(
self, id)
Whether there is a unit with this ID within the vision range. :type self: GameController :type id: int :rtype: bool
def can_sense_unit(self, id):
# type: (int) -> bool
'''Whether there is a unit with this ID within the vision range.
:type self: GameController
:type id: int
:rtype: bool
'''
result = _lib.bc_GameController_can_sense_unit(self._ptr, id)
_check_errors()
result = bool(result)
return result
def can_unload(
self, structure_id, direction)
Tests whether the given structure is able to unload a unit in the given direction. There must be space in that direction, and the unit must be ready to move. :type self: GameController :type structure_id: int :type direction: Direction :rtype: bool
def can_unload(self, structure_id, direction):
# type: (int, Direction) -> bool
'''Tests whether the given structure is able to unload a unit in the given direction. There must be space in that direction, and the unit must be ready to move.
:type self: GameController
:type structure_id: int
:type direction: Direction
:rtype: bool
'''
result = _lib.bc_GameController_can_unload(self._ptr, structure_id, direction)
_check_errors()
result = bool(result)
return result
def current_duration_of_flight(
self)
The current duration of flight if a rocket were to be launched this round. Does not take into account any research done on rockets. :type self: GameController :rtype: int
def current_duration_of_flight(self):
# type: () -> int
'''The current duration of flight if a rocket were to be launched this round. Does not take into account any research done on rockets.
:type self: GameController
:rtype: int
'''
result = _lib.bc_GameController_current_duration_of_flight(self._ptr)
_check_errors()
return result
def disintegrate_unit(
self, unit_id)
Disintegrates the unit and removes it from the map. If the unit is a factory or a rocket, also disintegrates any units garrisoned inside it.
- NoSuchUnit - the unit does not exist (inside the vision range).
- TeamNotAllowed - the unit is not on the current player's team. :type self: GameController :type unit_id: int :rtype: None
def disintegrate_unit(self, unit_id):
# type: (int) -> None
'''Disintegrates the unit and removes it from the map. If the unit is a factory or a rocket, also disintegrates any units garrisoned inside it.
* NoSuchUnit - the unit does not exist (inside the vision range).
* TeamNotAllowed - the unit is not on the current player's team.
:type self: GameController
:type unit_id: int
:rtype: None
'''
result = _lib.bc_GameController_disintegrate_unit(self._ptr, unit_id)
_check_errors()
return result
def get_team_array(
self, planet)
Gets a read-only version of this planet's team array. If the given planet is different from the planet of the player, reads the version of the planet's team array from COMMUNICATION_DELAY rounds prior. :type self: GameController :type planet: Planet :rtype: Veci32
def get_team_array(self, planet):
# type: (Planet) -> Veci32
'''Gets a read-only version of this planet's team array. If the given planet is different from the planet of the player, reads the version of the planet's team array from COMMUNICATION_DELAY rounds prior.
:type self: GameController
:type planet: Planet
:rtype: Veci32
'''
result = _lib.bc_GameController_get_team_array(self._ptr, planet)
_check_errors()
_result = Veci32.__new__(Veci32)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def harvest(
self, worker_id, direction)
Harvests up to the worker's harvest amount of karbonite from the given location, adding it to the team's resource pool.
- NoSuchUnit - the worker does not exist (within the vision range).
- TeamNotAllowed - the worker is not on the current player's team.
- InappropriateUnitType - the unit is not a worker.
- Overheated - the worker has already performed an action this turn.
- UnitNotOnMap - the worker is not on the map.
- LocationOffMap - the location in the target direction is off the map.
- LocationNotVisible - the location is not in the vision range.
- KarboniteDepositEmpty - the location described contains no Karbonite. :type self: GameController :type worker_id: int :type direction: Direction :rtype: None
def harvest(self, worker_id, direction):
# type: (int, Direction) -> None
'''Harvests up to the worker's harvest amount of karbonite from the given location, adding it to the team's resource pool.
* NoSuchUnit - the worker does not exist (within the vision range).
* TeamNotAllowed - the worker is not on the current player's team.
* InappropriateUnitType - the unit is not a worker.
* Overheated - the worker has already performed an action this turn.
* UnitNotOnMap - the worker is not on the map.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotVisible - the location is not in the vision range.
* KarboniteDepositEmpty - the location described contains no Karbonite.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_harvest(self._ptr, worker_id, direction)
_check_errors()
return result
def has_unit_at_location(
self, location)
Whether there is a visible unit at a location. :type self: GameController :type location: MapLocation :rtype: bool
def has_unit_at_location(self, location):
# type: (MapLocation) -> bool
'''Whether there is a visible unit at a location.
:type self: GameController
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_has_unit_at_location(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def heal(
self, healer_id, target_robot_id)
Commands the healer to heal the target robot.
- NoSuchUnit - either unit does not exist (inside the vision range).
- InappropriateUnitType - the unit is not a healer, or the target is not a robot.
- TeamNotAllowed - either robot is not on the current player's team.
- UnitNotOnMap - the healer is not on the map.
- OutOfRange - the target does not lie within "attack" range of the healer.
- Overheated - the healer is not ready to heal again. :type self: GameController :type healer_id: int :type target_robot_id: int :rtype: None
def heal(self, healer_id, target_robot_id):
# type: (int, int) -> None
'''Commands the healer to heal the target robot.
* NoSuchUnit - either unit does not exist (inside the vision range).
* InappropriateUnitType - the unit is not a healer, or the target is not a robot.
* TeamNotAllowed - either robot is not on the current player's team.
* UnitNotOnMap - the healer is not on the map.
* OutOfRange - the target does not lie within "attack" range of the healer.
* Overheated - the healer is not ready to heal again.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: None
'''
result = _lib.bc_GameController_heal(self._ptr, healer_id, target_robot_id)
_check_errors()
return result
def initial_start_turn_message(
self)
:type self: GameController :rtype: InitialTurnApplication
def initial_start_turn_message(self):
# type: () -> InitialTurnApplication
'''
:type self: GameController
:rtype: InitialTurnApplication
'''
result = _lib.bc_GameController_initial_start_turn_message(self._ptr)
_check_errors()
_result = InitialTurnApplication.__new__(InitialTurnApplication)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def is_attack_ready(
self, robot_id)
Whether the robot is ready to attack. Tests whether the robot's attack heat is sufficiently low.
Healers cannot attack, and should use is_heal_ready() instead. :type self: GameController :type robot_id: int :rtype: bool
def is_attack_ready(self, robot_id):
# type: (int) -> bool
'''Whether the robot is ready to attack. Tests whether the robot's attack heat is sufficiently low.
Healers cannot attack, and should use is_heal_ready() instead.
:type self: GameController
:type robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_attack_ready(self._ptr, robot_id)
_check_errors()
result = bool(result)
return result
def is_begin_snipe_ready(
self, ranger_id)
Whether the ranger is ready to begin snipe. Tests whether the ranger's ability heat is sufficiently low. :type self: GameController :type ranger_id: int :rtype: bool
def is_begin_snipe_ready(self, ranger_id):
# type: (int) -> bool
'''Whether the ranger is ready to begin snipe. Tests whether the ranger's ability heat is sufficiently low.
:type self: GameController
:type ranger_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_begin_snipe_ready(self._ptr, ranger_id)
_check_errors()
result = bool(result)
return result
def is_blink_ready(
self, mage_id)
Whether the mage is ready to blink. Tests whether the mage's ability heat is sufficiently low. :type self: GameController :type mage_id: int :rtype: bool
def is_blink_ready(self, mage_id):
# type: (int) -> bool
'''Whether the mage is ready to blink. Tests whether the mage's ability heat is sufficiently low.
:type self: GameController
:type mage_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_blink_ready(self._ptr, mage_id)
_check_errors()
result = bool(result)
return result
def is_heal_ready(
self, healer_id)
Whether the healer is ready to heal. Tests whether the healer's attack heat is sufficiently low. :type self: GameController :type healer_id: int :rtype: bool
def is_heal_ready(self, healer_id):
# type: (int) -> bool
'''Whether the healer is ready to heal. Tests whether the healer's attack heat is sufficiently low.
:type self: GameController
:type healer_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_heal_ready(self._ptr, healer_id)
_check_errors()
result = bool(result)
return result
def is_javelin_ready(
self, knight_id)
Whether the knight is ready to javelin. Tests whether the knight's ability heat is sufficiently low. :type self: GameController :type knight_id: int :rtype: bool
def is_javelin_ready(self, knight_id):
# type: (int) -> bool
'''Whether the knight is ready to javelin. Tests whether the knight's ability heat is sufficiently low.
:type self: GameController
:type knight_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_javelin_ready(self._ptr, knight_id)
_check_errors()
result = bool(result)
return result
def is_move_ready(
self, robot_id)
Whether the robot is ready to move. Tests whether the robot's attack heat is sufficiently low. :type self: GameController :type robot_id: int :rtype: bool
def is_move_ready(self, robot_id):
# type: (int) -> bool
'''Whether the robot is ready to move. Tests whether the robot's attack heat is sufficiently low.
:type self: GameController
:type robot_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_move_ready(self._ptr, robot_id)
_check_errors()
result = bool(result)
return result
def is_occupiable(
self, location)
Whether the location is clear for a unit to occupy, either by movement or by construction.
- LocationOffMap - the location is off the map.
- LocationNotVisible - the location is outside the vision range. :type self: GameController :type location: MapLocation :rtype: bool
def is_occupiable(self, location):
# type: (MapLocation) -> bool
'''Whether the location is clear for a unit to occupy, either by movement or by construction.
* LocationOffMap - the location is off the map.
* LocationNotVisible - the location is outside the vision range.
:type self: GameController
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_GameController_is_occupiable(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def is_over(
self)
:type self: GameController :rtype: bool
def is_over(self):
# type: () -> bool
'''
:type self: GameController
:rtype: bool
'''
result = _lib.bc_GameController_is_over(self._ptr)
_check_errors()
result = bool(result)
return result
def is_overcharge_ready(
self, healer_id)
Whether the healer is ready to overcharge. Tests whether the healer's ability heat is sufficiently low. :type self: GameController :type healer_id: int :rtype: bool
def is_overcharge_ready(self, healer_id):
# type: (int) -> bool
'''Whether the healer is ready to overcharge. Tests whether the healer's ability heat is sufficiently low.
:type self: GameController
:type healer_id: int
:rtype: bool
'''
result = _lib.bc_GameController_is_overcharge_ready(self._ptr, healer_id)
_check_errors()
result = bool(result)
return result
def javelin(
self, knight_id, target_unit_id)
Javelins the robot, dealing the knight's standard damage.
- NoSuchUnit - either unit does not exist (inside the vision range).
- TeamNotAllowed - the knight is not on the current player's team.
- UnitNotOnMap - the knight is not on the map.
- InappropriateUnitType - the unit is not a knight.
- ResearchNotUnlocked - you do not have the needed research to use javelin.
- OutOfRange - the target does not lie within ability range of the knight.
- Overheated - the knight is not ready to use javelin again. :type self: GameController :type knight_id: int :type target_unit_id: int :rtype: None
def javelin(self, knight_id, target_unit_id):
# type: (int, int) -> None
'''Javelins the robot, dealing the knight's standard damage.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - the knight is not on the current player's team.
* UnitNotOnMap - the knight is not on the map.
* InappropriateUnitType - the unit is not a knight.
* ResearchNotUnlocked - you do not have the needed research to use javelin.
* OutOfRange - the target does not lie within ability range of the knight.
* Overheated - the knight is not ready to use javelin again.
:type self: GameController
:type knight_id: int
:type target_unit_id: int
:rtype: None
'''
result = _lib.bc_GameController_javelin(self._ptr, knight_id, target_unit_id)
_check_errors()
return result
def karbonite(
self)
The karbonite in the team's resource pool. :type self: GameController :rtype: int
def karbonite(self):
# type: () -> int
'''The karbonite in the team's resource pool.
:type self: GameController
:rtype: int
'''
result = _lib.bc_GameController_karbonite(self._ptr)
_check_errors()
return result
def karbonite_at(
self, location)
The karbonite at the given location.
- LocationOffMap - the location is off the map.
- LocationNotVisible - the location is outside the vision range. :type self: GameController :type location: MapLocation :rtype: int
def karbonite_at(self, location):
# type: (MapLocation) -> int
'''The karbonite at the given location.
* LocationOffMap - the location is off the map.
* LocationNotVisible - the location is outside the vision range.
:type self: GameController
:type location: MapLocation
:rtype: int
'''
result = _lib.bc_GameController_karbonite_at(self._ptr, location._ptr)
_check_errors()
return result
def launch_rocket(
self, rocket_id, location)
Launches the rocket into space, damaging the units adjacent to the takeoff location.
- NoSuchUnit - the rocket does not exist (inside the vision range).
- TeamNotAllowed - the rocket is not on the current player's team.
- SamePlanet - the rocket cannot fly to a location on the same planet.
- InappropriateUnitType - the unit is not a rocket.
- StructureNotYetBuilt - the rocket has not yet been completed.
- RocketUsed - the rocket has already been used.
- LocationOffMap - the given location is off the map.
- LocationNotEmpty - the given location contains impassable terrain. :type self: GameController :type rocket_id: int :type location: MapLocation :rtype: None
def launch_rocket(self, rocket_id, location):
# type: (int, MapLocation) -> None
'''Launches the rocket into space, damaging the units adjacent to the takeoff location.
* NoSuchUnit - the rocket does not exist (inside the vision range).
* TeamNotAllowed - the rocket is not on the current player's team.
* SamePlanet - the rocket cannot fly to a location on the same planet.
* InappropriateUnitType - the unit is not a rocket.
* StructureNotYetBuilt - the rocket has not yet been completed.
* RocketUsed - the rocket has already been used.
* LocationOffMap - the given location is off the map.
* LocationNotEmpty - the given location contains impassable terrain.
:type self: GameController
:type rocket_id: int
:type location: MapLocation
:rtype: None
'''
result = _lib.bc_GameController_launch_rocket(self._ptr, rocket_id, location._ptr)
_check_errors()
return result
def load(
self, structure_id, robot_id)
Loads the robot into the garrison of the structure.
- NoSuchUnit - either unit does not exist (inside the vision range).
- TeamNotAllowed - either unit is not on the current player's team.
- UnitNotOnMap - either unit is not on the map.
- Overheated - the robot is not ready to move again.
- InappropriateUnitType - the first unit is not a structure, or the second unit is not a robot.
- StructureNotYetBuilt - the structure has not yet been completed.
- GarrisonFull - the structure's garrison is already full.
- OutOfRange - the robot is not adjacent to the structure. :type self: GameController :type structure_id: int :type robot_id: int :rtype: None
def load(self, structure_id, robot_id):
# type: (int, int) -> None
'''Loads the robot into the garrison of the structure.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - either unit is not on the map.
* Overheated - the robot is not ready to move again.
* InappropriateUnitType - the first unit is not a structure, or the second unit is not a robot.
* StructureNotYetBuilt - the structure has not yet been completed.
* GarrisonFull - the structure's garrison is already full.
* OutOfRange - the robot is not adjacent to the structure.
:type self: GameController
:type structure_id: int
:type robot_id: int
:rtype: None
'''
result = _lib.bc_GameController_load(self._ptr, structure_id, robot_id)
_check_errors()
return result
def move_robot(
self, robot_id, direction)
Moves the robot in the given direction.
- NoSuchUnit - the robot does not exist (within the vision range).
- TeamNotAllowed - the robot is not on the current player's team.
- UnitNotOnMap - the robot is not on the map.
- LocationNotVisible - the location is outside the vision range.
- LocationOffMap - the location is off the map.
- LocationNotEmpty - the location is occupied by a unit or terrain.
- Overheated - the robot is not ready to move again. :type self: GameController :type robot_id: int :type direction: Direction :rtype: None
def move_robot(self, robot_id, direction):
# type: (int, Direction) -> None
'''Moves the robot in the given direction.
* NoSuchUnit - the robot does not exist (within the vision range).
* TeamNotAllowed - the robot is not on the current player's team.
* UnitNotOnMap - the robot is not on the map.
* LocationNotVisible - the location is outside the vision range.
* LocationOffMap - the location is off the map.
* LocationNotEmpty - the location is occupied by a unit or terrain.
* Overheated - the robot is not ready to move again.
:type self: GameController
:type robot_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_move_robot(self._ptr, robot_id, direction)
_check_errors()
return result
def my_units(
self)
All the units on your team. Does not include units in space. :type self: GameController :rtype: VecUnit
def my_units(self):
# type: () -> VecUnit
'''All the units on your team. Does not include units in space.
:type self: GameController
:rtype: VecUnit
'''
result = _lib.bc_GameController_my_units(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def new_manager(
map)
:type map: GameMap :rtype: GameController
@staticmethod
def new_manager(map):
# type: (GameMap) -> GameController
'''
:type map: GameMap
:rtype: GameController
'''
result = _lib.bc_GameController_new_manager(map._ptr)
_check_errors()
_result = GameController.__new__(GameController)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def next_turn(
self)
Send the moves from the current turn and wait for the next turn. :type self: GameController :rtype: None
def next_turn(self):
# type: () -> None
'''Send the moves from the current turn and wait for the next turn.
:type self: GameController
:rtype: None
'''
result = _lib.bc_GameController_next_turn(self._ptr)
_check_errors()
return result
def orbit_pattern(
self)
The orbit pattern that determines a rocket's flight duration. :type self: GameController :rtype: OrbitPattern
def orbit_pattern(self):
# type: () -> OrbitPattern
'''The orbit pattern that determines a rocket's flight duration.
:type self: GameController
:rtype: OrbitPattern
'''
result = _lib.bc_GameController_orbit_pattern(self._ptr)
_check_errors()
_result = OrbitPattern.__new__(OrbitPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def overcharge(
self, healer_id, target_robot_id)
Overcharges the robot, resetting the robot's cooldowns. The robot must be on the same team as you.
- NoSuchUnit - either unit does not exist (inside the vision range).
- TeamNotAllowed - either robot is not on the current player's team.
- UnitNotOnMap - the healer is not on the map.
- InappropriateUnitType - the unit is not a healer, or the target is not a robot.
- ResearchNotUnlocked - you do not have the needed research to use overcharge.
- OutOfRange - the target does not lie within ability range of the healer.
- Overheated - the healer is not ready to use overcharge again. :type self: GameController :type healer_id: int :type target_robot_id: int :rtype: None
def overcharge(self, healer_id, target_robot_id):
# type: (int, int) -> None
'''Overcharges the robot, resetting the robot's cooldowns. The robot must be on the same team as you.
* NoSuchUnit - either unit does not exist (inside the vision range).
* TeamNotAllowed - either robot is not on the current player's team.
* UnitNotOnMap - the healer is not on the map.
* InappropriateUnitType - the unit is not a healer, or the target is not a robot.
* ResearchNotUnlocked - you do not have the needed research to use overcharge.
* OutOfRange - the target does not lie within ability range of the healer.
* Overheated - the healer is not ready to use overcharge again.
:type self: GameController
:type healer_id: int
:type target_robot_id: int
:rtype: None
'''
result = _lib.bc_GameController_overcharge(self._ptr, healer_id, target_robot_id)
_check_errors()
return result
def planet(
self)
The current planet. :type self: GameController :rtype: Planet
def planet(self):
# type: () -> Planet
'''The current planet.
:type self: GameController
:rtype: Planet
'''
result = _lib.bc_GameController_planet(self._ptr)
_check_errors()
result = Planet(result)
return result
def produce_robot(
self, factory_id, robot_type)
Starts producing the robot of the given type.
- NoSuchUnit - the factory does not exist (inside the vision range).
- TeamNotAllowed - the factory is not on the current player's team.
- InappropriateUnitType - the unit is not a factory, or the unit type is not a robot.
- StructureNotYetBuilt - the factory has not yet been completed.
- FactoryBusy - the factory is already producing a unit.
- InsufficientKarbonite - your team does not have enough Karbonite to produce the given robot. :type self: GameController :type factory_id: int :type robot_type: UnitType :rtype: None
def produce_robot(self, factory_id, robot_type):
# type: (int, UnitType) -> None
'''Starts producing the robot of the given type.
* NoSuchUnit - the factory does not exist (inside the vision range).
* TeamNotAllowed - the factory is not on the current player's team.
* InappropriateUnitType - the unit is not a factory, or the unit type is not a robot.
* StructureNotYetBuilt - the factory has not yet been completed.
* FactoryBusy - the factory is already producing a unit.
* InsufficientKarbonite - your team does not have enough Karbonite to produce the given robot.
:type self: GameController
:type factory_id: int
:type robot_type: UnitType
:rtype: None
'''
result = _lib.bc_GameController_produce_robot(self._ptr, factory_id, robot_type)
_check_errors()
return result
def queue_research(
self, branch)
Adds a branch to the back of the queue, if it is a valid upgrade, and starts research if it is the first in the queue.
Returns whether the branch was successfully added. :type self: GameController :type branch: UnitType :rtype: bool
def queue_research(self, branch):
# type: (UnitType) -> bool
'''Adds a branch to the back of the queue, if it is a valid upgrade, and starts research if it is the first in the queue.
Returns whether the branch was successfully added.
:type self: GameController
:type branch: UnitType
:rtype: bool
'''
result = _lib.bc_GameController_queue_research(self._ptr, branch)
_check_errors()
result = bool(result)
return result
def repair(
self, worker_id, structure_id)
Commands the worker to repair a structure, repleneshing health to it. This can only be done to structures which have been fully built.
- NoSuchUnit - either unit does not exist (within the vision range).
- TeamNotAllowed - either unit is not on the current player's team.
- UnitNotOnMap - the worker is not on the map.
- InappropriateUnitType - the unit is not a worker, or the target is not a structure.
- Overheated - the worker has already performed an action this turn.
- OutOfRange - the worker is not adjacent to the structure.
- StructureNotYetBuilt - the structure has not been completed. :type self: GameController :type worker_id: int :type structure_id: int :rtype: None
def repair(self, worker_id, structure_id):
# type: (int, int) -> None
'''Commands the worker to repair a structure, repleneshing health to it. This can only be done to structures which have been fully built.
* NoSuchUnit - either unit does not exist (within the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - the worker is not on the map.
* InappropriateUnitType - the unit is not a worker, or the target is not a structure.
* Overheated - the worker has already performed an action this turn.
* OutOfRange - the worker is not adjacent to the structure.
* StructureNotYetBuilt - the structure has not been completed.
:type self: GameController
:type worker_id: int
:type structure_id: int
:rtype: None
'''
result = _lib.bc_GameController_repair(self._ptr, worker_id, structure_id)
_check_errors()
return result
def replicate(
self, worker_id, direction)
Replicates a worker in the given direction. Subtracts the cost of the worker from the team's resource pool.
- NoSuchUnit - the worker does not exist (within the vision range).
- TeamNotAllowed - the worker is not on the current player's team.
- InappropriateUnitType - the unit is not a worker.
- Overheated - the worker is not ready to replicate again.
- InsufficientKarbonite - your team does not have enough Karbonite for the worker to replicate.
- UnitNotOnMap - the worker is not on the map.
- LocationOffMap - the location in the target direction is off the map.
- LocationNotVisible - the location is outside the vision range.
- LocationNotEmpty - the location in the target direction is already occupied. :type self: GameController :type worker_id: int :type direction: Direction :rtype: None
def replicate(self, worker_id, direction):
# type: (int, Direction) -> None
'''Replicates a worker in the given direction. Subtracts the cost of the worker from the team's resource pool.
* NoSuchUnit - the worker does not exist (within the vision range).
* TeamNotAllowed - the worker is not on the current player's team.
* InappropriateUnitType - the unit is not a worker.
* Overheated - the worker is not ready to replicate again.
* InsufficientKarbonite - your team does not have enough Karbonite for the worker to replicate.
* UnitNotOnMap - the worker is not on the map.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotVisible - the location is outside the vision range.
* LocationNotEmpty - the location in the target direction is already occupied.
:type self: GameController
:type worker_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_replicate(self._ptr, worker_id, direction)
_check_errors()
return result
def research_info(
self)
The research info of the current team, including what branch is currently being researched, the number of rounds left. :type self: GameController :rtype: ResearchInfo
def research_info(self):
# type: () -> ResearchInfo
'''The research info of the current team, including what branch is currently being researched, the number of rounds left.
:type self: GameController
:rtype: ResearchInfo
'''
result = _lib.bc_GameController_research_info(self._ptr)
_check_errors()
_result = ResearchInfo.__new__(ResearchInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def reset_research(
self)
Resets the research queue to be empty. Returns true if the queue was not empty before, and false otherwise. :type self: GameController :rtype: bool
def reset_research(self):
# type: () -> bool
'''Resets the research queue to be empty. Returns true if the queue was not empty before, and false otherwise.
:type self: GameController
:rtype: bool
'''
result = _lib.bc_GameController_reset_research(self._ptr)
_check_errors()
result = bool(result)
return result
def rocket_landings(
self)
The landing rounds and locations of rockets in space that belong to the current team. :type self: GameController :rtype: RocketLandingInfo
def rocket_landings(self):
# type: () -> RocketLandingInfo
'''The landing rounds and locations of rockets in space that belong to the current team.
:type self: GameController
:rtype: RocketLandingInfo
'''
result = _lib.bc_GameController_rocket_landings(self._ptr)
_check_errors()
_result = RocketLandingInfo.__new__(RocketLandingInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def round(
self)
The current round, starting at round 1 and up to ROUND_LIMIT rounds. A round consists of a turn from each team on each planet. :type self: GameController :rtype: int
def round(self):
# type: () -> int
'''The current round, starting at round 1 and up to ROUND_LIMIT rounds. A round consists of a turn from each team on each planet.
:type self: GameController
:rtype: int
'''
result = _lib.bc_GameController_round(self._ptr)
_check_errors()
return result
def sense_nearby_units(
self, location, radius)
Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range. :type self: GameController :type location: MapLocation :type radius: int :rtype: VecUnit
def sense_nearby_units(self, location, radius):
# type: (MapLocation, int) -> VecUnit
'''Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range.
:type self: GameController
:type location: MapLocation
:type radius: int
:rtype: VecUnit
'''
result = _lib.bc_GameController_sense_nearby_units(self._ptr, location._ptr, radius)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def sense_nearby_units_by_team(
self, location, radius, team)
Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range. Additionally filters the units by team. :type self: GameController :type location: MapLocation :type radius: int :type team: Team :rtype: VecUnit
def sense_nearby_units_by_team(self, location, radius, team):
# type: (MapLocation, int, Team) -> VecUnit
'''Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range. Additionally filters the units by team.
:type self: GameController
:type location: MapLocation
:type radius: int
:type team: Team
:rtype: VecUnit
'''
result = _lib.bc_GameController_sense_nearby_units_by_team(self._ptr, location._ptr, radius, team)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def sense_nearby_units_by_type(
self, location, radius, unit_type)
Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range. Additionally filters the units by unit type. :type self: GameController :type location: MapLocation :type radius: int :type unit_type: UnitType :rtype: VecUnit
def sense_nearby_units_by_type(self, location, radius, unit_type):
# type: (MapLocation, int, UnitType) -> VecUnit
'''Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range. Additionally filters the units by unit type.
:type self: GameController
:type location: MapLocation
:type radius: int
:type unit_type: UnitType
:rtype: VecUnit
'''
result = _lib.bc_GameController_sense_nearby_units_by_type(self._ptr, location._ptr, radius, unit_type)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def sense_unit_at_location(
self, location)
The unit at the location, if it exists.
- LocationOffMap - the location is off the map.
- LocationNotVisible - the location is outside the vision range. :type self: GameController :type location: MapLocation :rtype: Unit
def sense_unit_at_location(self, location):
# type: (MapLocation) -> Unit
'''The unit at the location, if it exists.
* LocationOffMap - the location is off the map.
* LocationNotVisible - the location is outside the vision range.
:type self: GameController
:type location: MapLocation
:rtype: Unit
'''
result = _lib.bc_GameController_sense_unit_at_location(self._ptr, location._ptr)
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def start_game(
self, player)
:type self: GameController :type player: Player :rtype: StartGameMessage
def start_game(self, player):
# type: (Player) -> StartGameMessage
'''
:type self: GameController
:type player: Player
:rtype: StartGameMessage
'''
result = _lib.bc_GameController_start_game(self._ptr, player._ptr)
_check_errors()
_result = StartGameMessage.__new__(StartGameMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def starting_map(
self, planet)
The starting map of the given planet. Includes the map's planet, dimensions, impassable terrain, and initial units and karbonite. :type self: GameController :type planet: Planet :rtype: PlanetMap
def starting_map(self, planet):
# type: (Planet) -> PlanetMap
'''The starting map of the given planet. Includes the map's planet, dimensions, impassable terrain, and initial units and karbonite.
:type self: GameController
:type planet: Planet
:rtype: PlanetMap
'''
result = _lib.bc_GameController_starting_map(self._ptr, planet)
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def team(
self)
The team whose turn it is. :type self: GameController :rtype: Team
def team(self):
# type: () -> Team
'''The team whose turn it is.
:type self: GameController
:rtype: Team
'''
result = _lib.bc_GameController_team(self._ptr)
_check_errors()
result = Team(result)
return result
def unit(
self, id)
The single unit with this ID. Use this method to get detailed statistics on a unit - heat, cooldowns, and properties of special abilities like units garrisoned in a rocket.
- NoSuchUnit - the unit does not exist (inside the vision range). :type self: GameController :type id: int :rtype: Unit
def unit(self, id):
# type: (int) -> Unit
'''The single unit with this ID. Use this method to get detailed statistics on a unit - heat, cooldowns, and properties of special abilities like units garrisoned in a rocket.
* NoSuchUnit - the unit does not exist (inside the vision range).
:type self: GameController
:type id: int
:rtype: Unit
'''
result = _lib.bc_GameController_unit(self._ptr, id)
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def units(
self)
All the units within the vision range, in no particular order. Does not include units in space. :type self: GameController :rtype: VecUnit
def units(self):
# type: () -> VecUnit
'''All the units within the vision range, in no particular order. Does not include units in space.
:type self: GameController
:rtype: VecUnit
'''
result = _lib.bc_GameController_units(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def units_in_space(
self)
All the units of this team that are in space. You cannot see units on the other team that are in space. :type self: GameController :rtype: VecUnit
def units_in_space(self):
# type: () -> VecUnit
'''All the units of this team that are in space. You cannot see units on the other team that are in space.
:type self: GameController
:rtype: VecUnit
'''
result = _lib.bc_GameController_units_in_space(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def unload(
self, structure_id, direction)
Unloads a robot from the garrison of the specified structure into an adjacent space. Robots are unloaded in the order they were loaded.
- NoSuchUnit - the unit does not exist (inside the vision range).
- TeamNotAllowed - either unit is not on the current player's team.
- UnitNotOnMap - the structure is not on the map.
- InappropriateUnitType - the unit is not a structure.
- StructureNotYetBuilt - the structure has not yet been completed.
- GarrisonEmpty - the structure's garrison is already empty.
- LocationOffMap - the location in the target direction is off the map.
- LocationNotEmpty - the location in the target direction is already occupied.
- Overheated - the robot inside the structure is not ready to move again. :type self: GameController :type structure_id: int :type direction: Direction :rtype: None
def unload(self, structure_id, direction):
# type: (int, Direction) -> None
'''Unloads a robot from the garrison of the specified structure into an adjacent space. Robots are unloaded in the order they were loaded.
* NoSuchUnit - the unit does not exist (inside the vision range).
* TeamNotAllowed - either unit is not on the current player's team.
* UnitNotOnMap - the structure is not on the map.
* InappropriateUnitType - the unit is not a structure.
* StructureNotYetBuilt - the structure has not yet been completed.
* GarrisonEmpty - the structure's garrison is already empty.
* LocationOffMap - the location in the target direction is off the map.
* LocationNotEmpty - the location in the target direction is already occupied.
* Overheated - the robot inside the structure is not ready to move again.
:type self: GameController
:type structure_id: int
:type direction: Direction
:rtype: None
'''
result = _lib.bc_GameController_unload(self._ptr, structure_id, direction)
_check_errors()
return result
def winning_team(
self)
:type self: GameController :rtype: Team
def winning_team(self):
# type: () -> Team
'''
:type self: GameController
:rtype: Team
'''
result = _lib.bc_GameController_winning_team(self._ptr)
_check_errors()
result = Team(result)
return result
def write_team_array(
self, index, value)
Writes the value at the index of this planet's team array.
- ArrayOutOfBounds - the index of the array is out of bounds. It must be within [0, COMMUNICATION_ARRAY_LENGTH). :type self: GameController :type index: int :type value: int :rtype: None
def write_team_array(self, index, value):
# type: (int, int) -> None
'''Writes the value at the index of this planet's team array.
* ArrayOutOfBounds - the index of the array is out of bounds. It must be within [0, COMMUNICATION_ARRAY_LENGTH).
:type self: GameController
:type index: int
:type value: int
:rtype: None
'''
result = _lib.bc_GameController_write_team_array(self._ptr, index, value)
_check_errors()
return result
class GameMap
class GameMap(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> GameMap
'''The map defining the starting state for an entire game.
:type self: GameMap
:rtype: GameMap
'''
ptr = _lib.new_bc_GameMap()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: GameMap
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_GameMap(self._ptr)
_check_errors()
@property
def seed(self):
# type: () -> int
'''Seed for random number generation.
:type self: GameMap
:rtype: int
'''
result = _lib.bc_GameMap_seed_get(self._ptr)
_check_errors()
return result
@property
def earth_map(self):
# type: () -> PlanetMap
'''Earth map.
:type self: GameMap
:rtype: PlanetMap
'''
result = _lib.bc_GameMap_earth_map_get(self._ptr)
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@property
def mars_map(self):
# type: () -> PlanetMap
'''Mars map.
:type self: GameMap
:rtype: PlanetMap
'''
result = _lib.bc_GameMap_mars_map_get(self._ptr)
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@property
def asteroids(self):
# type: () -> AsteroidPattern
'''The asteroid strike pattern on Mars.
:type self: GameMap
:rtype: AsteroidPattern
'''
result = _lib.bc_GameMap_asteroids_get(self._ptr)
_check_errors()
_result = AsteroidPattern.__new__(AsteroidPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@property
def orbit(self):
# type: () -> OrbitPattern
'''The orbit pattern that determines a rocket's flight duration.
:type self: GameMap
:rtype: OrbitPattern
'''
result = _lib.bc_GameMap_orbit_get(self._ptr)
_check_errors()
_result = OrbitPattern.__new__(OrbitPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@seed.setter
def seed(self, seed):
# type: (int) -> None
'''Seed for random number generation.
:type self: GameMap
:type seed: int
:rtype: None
'''
result = _lib.bc_GameMap_seed_set(self._ptr, seed)
_check_errors()
return result
@earth_map.setter
def earth_map(self, earth_map):
# type: (PlanetMap) -> None
'''Earth map.
:type self: GameMap
:type earth_map: PlanetMap
:rtype: None
'''
result = _lib.bc_GameMap_earth_map_set(self._ptr, earth_map._ptr)
_check_errors()
return result
@mars_map.setter
def mars_map(self, mars_map):
# type: (PlanetMap) -> None
'''Mars map.
:type self: GameMap
:type mars_map: PlanetMap
:rtype: None
'''
result = _lib.bc_GameMap_mars_map_set(self._ptr, mars_map._ptr)
_check_errors()
return result
@asteroids.setter
def asteroids(self, asteroids):
# type: (AsteroidPattern) -> None
'''The asteroid strike pattern on Mars.
:type self: GameMap
:type asteroids: AsteroidPattern
:rtype: None
'''
result = _lib.bc_GameMap_asteroids_set(self._ptr, asteroids._ptr)
_check_errors()
return result
@orbit.setter
def orbit(self, orbit):
# type: (OrbitPattern) -> None
'''The orbit pattern that determines a rocket's flight duration.
:type self: GameMap
:type orbit: OrbitPattern
:rtype: None
'''
result = _lib.bc_GameMap_orbit_set(self._ptr, orbit._ptr)
_check_errors()
return result
def validate(self):
# type: () -> None
'''Validate the game map.
* InvalidMapObject - the game map is invalid.
:type self: GameMap
:rtype: None
'''
result = _lib.bc_GameMap_validate(self._ptr)
_check_errors()
return result
@staticmethod
def test_map():
# type: () -> GameMap
'''
:rtype: GameMap
'''
result = _lib.bc_GameMap_test_map()
_check_errors()
_result = GameMap.__new__(GameMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def clone(self):
# type: () -> GameMap
'''Deep-copy a GameMap
:type self: GameMap
:rtype: GameMap
'''
result = _lib.bc_GameMap_clone(self._ptr)
_check_errors()
_result = GameMap.__new__(GameMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@staticmethod
def from_json(s):
# type: (str) -> GameMap
'''Deserialize a GameMap from a JSON string
:type s: str
:rtype: GameMap
'''
result = _lib.bc_GameMap_from_json(_ffi.new("char[]", s))
_check_errors()
_result = GameMap.__new__(GameMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a GameMap to a JSON string
:type self: GameMap
:rtype: str
'''
result = _lib.bc_GameMap_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- GameMap
- builtins.object
Static methods
def __init__(
self)
The map defining the starting state for an entire game. :type self: GameMap :rtype: GameMap
def __init__(self):
# type: () -> GameMap
'''The map defining the starting state for an entire game.
:type self: GameMap
:rtype: GameMap
'''
ptr = _lib.new_bc_GameMap()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a GameMap :type self: GameMap :rtype: GameMap
def clone(self):
# type: () -> GameMap
'''Deep-copy a GameMap
:type self: GameMap
:rtype: GameMap
'''
result = _lib.bc_GameMap_clone(self._ptr)
_check_errors()
_result = GameMap.__new__(GameMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a GameMap from a JSON string :type s: str :rtype: GameMap
@staticmethod
def from_json(s):
# type: (str) -> GameMap
'''Deserialize a GameMap from a JSON string
:type s: str
:rtype: GameMap
'''
result = _lib.bc_GameMap_from_json(_ffi.new("char[]", s))
_check_errors()
_result = GameMap.__new__(GameMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def test_map(
)
:rtype: GameMap
@staticmethod
def test_map():
# type: () -> GameMap
'''
:rtype: GameMap
'''
result = _lib.bc_GameMap_test_map()
_check_errors()
_result = GameMap.__new__(GameMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a GameMap to a JSON string :type self: GameMap :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a GameMap to a JSON string
:type self: GameMap
:rtype: str
'''
result = _lib.bc_GameMap_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def validate(
self)
Validate the game map.
- InvalidMapObject - the game map is invalid. :type self: GameMap :rtype: None
def validate(self):
# type: () -> None
'''Validate the game map.
* InvalidMapObject - the game map is invalid.
:type self: GameMap
:rtype: None
'''
result = _lib.bc_GameMap_validate(self._ptr)
_check_errors()
return result
Instance variables
var asteroids
The asteroid strike pattern on Mars. :type self: GameMap :rtype: AsteroidPattern
var earth_map
Earth map. :type self: GameMap :rtype: PlanetMap
var mars_map
Mars map. :type self: GameMap :rtype: PlanetMap
var orbit
The orbit pattern that determines a rocket's flight duration. :type self: GameMap :rtype: OrbitPattern
var seed
Seed for random number generation. :type self: GameMap :rtype: int
class InitialTurnApplication
class InitialTurnApplication(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> InitialTurnApplication
'''
:type self: InitialTurnApplication
:rtype: InitialTurnApplication
'''
ptr = _lib.new_bc_InitialTurnApplication()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: InitialTurnApplication
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_InitialTurnApplication(self._ptr)
_check_errors()
@property
def start_turn(self):
# type: () -> StartTurnMessage
'''
:type self: InitialTurnApplication
:rtype: StartTurnMessage
'''
result = _lib.bc_InitialTurnApplication_start_turn_get(self._ptr)
_check_errors()
_result = StartTurnMessage.__new__(StartTurnMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@property
def viewer(self):
# type: () -> ViewerKeyframe
'''
:type self: InitialTurnApplication
:rtype: ViewerKeyframe
'''
result = _lib.bc_InitialTurnApplication_viewer_get(self._ptr)
_check_errors()
_result = ViewerKeyframe.__new__(ViewerKeyframe)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@start_turn.setter
def start_turn(self, start_turn):
# type: (StartTurnMessage) -> None
'''
:type self: InitialTurnApplication
:type start_turn: StartTurnMessage
:rtype: None
'''
result = _lib.bc_InitialTurnApplication_start_turn_set(self._ptr, start_turn._ptr)
_check_errors()
return result
@viewer.setter
def viewer(self, viewer):
# type: (ViewerKeyframe) -> None
'''
:type self: InitialTurnApplication
:type viewer: ViewerKeyframe
:rtype: None
'''
result = _lib.bc_InitialTurnApplication_viewer_set(self._ptr, viewer._ptr)
_check_errors()
return result
Ancestors (in MRO)
- InitialTurnApplication
- builtins.object
Static methods
def __init__(
self)
:type self: InitialTurnApplication :rtype: InitialTurnApplication
def __init__(self):
# type: () -> InitialTurnApplication
'''
:type self: InitialTurnApplication
:rtype: InitialTurnApplication
'''
ptr = _lib.new_bc_InitialTurnApplication()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
Instance variables
var start_turn
:type self: InitialTurnApplication :rtype: StartTurnMessage
var viewer
:type self: InitialTurnApplication :rtype: ViewerKeyframe
class Location
class Location(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> Location
'''
:type self: Location
:rtype: Location
'''
ptr = _lib.new_bc_Location()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: Location
:rtype: None
'''
if hasattr(self, '_ptr'):