Guest User

Untitled

a guest
Jan 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.49 KB | None | 0 0
  1. /// GENERATED C, DO NOT EDIT
  2. #ifndef bc_h_
  3. #define bc_h_
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. #include <stdint.h>
  9. uint8_t bc_has_err();
  10. int8_t bc_get_last_err(char** result);
  11. int8_t bc_free_string(char* err);
  12. /// The planets in the Battlecode world.
  13. typedef enum bc_Planet {
  14. Earth = 0,
  15. Mars = 1,
  16. } bc_Planet;
  17. /// The other planet.
  18. bc_Planet bc_Planet_other(bc_Planet this);
  19.  
  20. /// Create a human-readable representation of a Planet
  21. char* bc_Planet_debug(bc_Planet this);
  22.  
  23. /// Compare two Planets for deep equality.
  24. uint8_t bc_Planet_eq(bc_Planet this, bc_Planet other);
  25.  
  26. /// Deserialize a Planet from a JSON string
  27. bc_Planet bc_Planet_from_json(char* s);
  28.  
  29. /// Serialize a Planet to a JSON string
  30. char* bc_Planet_to_json(bc_Planet this);
  31. /// A direction from one MapLocation to another.
  32. ///
  33. /// Directions for each of the cardinals (north, south, east, west), and each
  34. /// of the diagonals (northwest, southwest, northeast, southeast). There is
  35. /// also a "center" direction, representing no direction.
  36. ///
  37. /// Coordinates increase in the north and east directions.
  38. typedef enum bc_Direction {
  39. North = 0,
  40. Northeast = 1,
  41. East = 2,
  42. Southeast = 3,
  43. South = 4,
  44. Southwest = 5,
  45. West = 6,
  46. Northwest = 7,
  47. Center = 8,
  48. } bc_Direction;
  49. /// Returns the x displacement of this direction.
  50. int32_t bc_Direction_dx(bc_Direction this);
  51.  
  52. /// Returns the y displacement of this direction.
  53. int32_t bc_Direction_dy(bc_Direction this);
  54.  
  55. /// Whether this direction is a diagonal one.
  56. uint8_t bc_Direction_is_diagonal(bc_Direction this);
  57.  
  58. /// Returns the direction opposite this one, or Center if it's Center.
  59. bc_Direction bc_Direction_opposite(bc_Direction this);
  60.  
  61. /// Returns the direction 45 degrees to the left (counter-clockwise) of
  62. /// this one, or Center if it's Center.
  63. bc_Direction bc_Direction_rotate_left(bc_Direction this);
  64.  
  65. /// Returns the direction 45 degrees to the right (clockwise) of this one,
  66. /// or Center if it's Center.
  67. bc_Direction bc_Direction_rotate_right(bc_Direction this);
  68.  
  69. /// Deserialize a Direction from a JSON string
  70. bc_Direction bc_Direction_from_json(char* s);
  71.  
  72. /// Serialize a Direction to a JSON string
  73. char* bc_Direction_to_json(bc_Direction this);
  74. /// Two-dimensional coordinates in the Battlecode world.
  75. typedef struct bc_MapLocation bc_MapLocation;
  76. /// Returns a new MapLocation representing the location with the given
  77. /// coordinates on a planet.
  78. bc_MapLocation* new_bc_MapLocation(bc_Planet planet, int32_t x, int32_t y);
  79. ///
  80. void delete_bc_MapLocation(bc_MapLocation* this);
  81. /// The planet of the map location.
  82. bc_Planet bc_MapLocation_planet_get(bc_MapLocation* this);
  83. /// The x coordinate of the map location.
  84. int32_t bc_MapLocation_x_get(bc_MapLocation* this);
  85. /// The y coordinate of the map location.
  86. int32_t bc_MapLocation_y_get(bc_MapLocation* this);
  87. /// The planet of the map location.
  88. void bc_MapLocation_planet_set(bc_MapLocation* this, bc_Planet planet);
  89. /// The x coordinate of the map location.
  90. void bc_MapLocation_x_set(bc_MapLocation* this, int32_t x);
  91. /// The y coordinate of the map location.
  92. void bc_MapLocation_y_set(bc_MapLocation* this, int32_t y);
  93. /// Returns the location one square from this one in the given direction.
  94. bc_MapLocation* bc_MapLocation_add(bc_MapLocation* this, bc_Direction direction);
  95. /// Returns the location one square from this one in the opposite direction.
  96. bc_MapLocation* bc_MapLocation_subtract(bc_MapLocation* this, bc_Direction direction);
  97. /// Returns the location `multiple` squares from this one in the given
  98. /// direction.
  99. bc_MapLocation* bc_MapLocation_add_multiple(bc_MapLocation* this, bc_Direction direction, int32_t multiple);
  100. /// Returns the location translated from this location by `dx` in the x
  101. /// direction and `dy` in the y direction.
  102. bc_MapLocation* bc_MapLocation_translate(bc_MapLocation* this, int32_t dx, int32_t dy);
  103. /// Computes the square of the distance from this location to the specified
  104. /// location. If on different planets, returns the maximum integer.
  105. uint32_t bc_MapLocation_distance_squared_to(bc_MapLocation* this, bc_MapLocation* o);
  106. /// Returns the Direction from this location to the specified location.
  107. /// If the locations are equal this method returns Center.
  108. ///
  109. /// * DifferentPlanet - The locations are on different planets.
  110. bc_Direction bc_MapLocation_direction_to(bc_MapLocation* this, bc_MapLocation* o);
  111. ///
  112. /// Determines whether this location is adjacent to the specified location,
  113. /// including diagonally. Note that squares are not adjacent to themselves,
  114. /// and squares on different planets are not adjacent to each other.
  115. uint8_t bc_MapLocation_is_adjacent_to(bc_MapLocation* this, bc_MapLocation* o);
  116. ///
  117. /// Whether this location is within the distance squared range of the
  118. /// specified location, inclusive. False for locations on different planets.
  119. uint8_t bc_MapLocation_is_within_range(bc_MapLocation* this, uint32_t range, bc_MapLocation* o);
  120. /// Create a human-readable representation of a MapLocation
  121. char* bc_MapLocation_debug(bc_MapLocation* this);
  122. /// Deep-copy a MapLocation
  123. bc_MapLocation* bc_MapLocation_clone(bc_MapLocation* this);
  124. /// Compare two MapLocations for deep equality.
  125. uint8_t bc_MapLocation_eq(bc_MapLocation* this, bc_MapLocation* other);
  126. /// Deserialize a MapLocation from a JSON string
  127. bc_MapLocation* bc_MapLocation_from_json(char* s);
  128. /// Serialize a MapLocation to a JSON string
  129. char* bc_MapLocation_to_json(bc_MapLocation* this);
  130. /// An immutable list of bc::location::MapLocation objects
  131. typedef struct bc_VecMapLocation bc_VecMapLocation;
  132. /// An immutable list of bc::location::MapLocation objects
  133. bc_VecMapLocation* new_bc_VecMapLocation();
  134. ///
  135. void delete_bc_VecMapLocation(bc_VecMapLocation* this);
  136. /// Create a human-readable representation of a VecMapLocation
  137. char* bc_VecMapLocation_debug(bc_VecMapLocation* this);
  138. /// Deep-copy a VecMapLocation
  139. bc_VecMapLocation* bc_VecMapLocation_clone(bc_VecMapLocation* this);
  140. /// The length of the vector.
  141. uintptr_t bc_VecMapLocation_len(bc_VecMapLocation* this);
  142. /// Copy an element out of the vector.
  143. bc_MapLocation* bc_VecMapLocation_index(bc_VecMapLocation* this, uintptr_t index);
  144. /// An immutable list of i32 objects
  145. typedef struct bc_Veci32 bc_Veci32;
  146. /// An immutable list of i32 objects
  147. bc_Veci32* new_bc_Veci32();
  148. ///
  149. void delete_bc_Veci32(bc_Veci32* this);
  150. /// Create a human-readable representation of a Veci32
  151. char* bc_Veci32_debug(bc_Veci32* this);
  152. /// Deep-copy a Veci32
  153. bc_Veci32* bc_Veci32_clone(bc_Veci32* this);
  154. /// The length of the vector.
  155. uintptr_t bc_Veci32_len(bc_Veci32* this);
  156. /// Copy an element out of the vector.
  157. int32_t bc_Veci32_index(bc_Veci32* this, uintptr_t index);
  158. ///
  159. typedef struct bc_Location bc_Location;
  160. ///
  161. bc_Location* new_bc_Location();
  162. ///
  163. void delete_bc_Location(bc_Location* this);
  164. /// Constructs a new location on the map.
  165. bc_Location* bc_Location_new_on_map(bc_MapLocation* map_location);
  166. /// Constructs a new location in a garrison.
  167. bc_Location* bc_Location_new_in_garrison(uint16_t id);
  168. /// Constructs a new location in space.
  169. bc_Location* bc_Location_new_in_space();
  170. /// Whether the unit is on a map.
  171. uint8_t bc_Location_is_on_map(bc_Location* this);
  172. /// True if and only if the location is on the map and on this planet.
  173. uint8_t bc_Location_is_on_planet(bc_Location* this, bc_Planet planet);
  174. /// The map location of the unit.
  175. ///
  176. /// * UnitNotOnMap - The unit is in a garrison or in space, and does not
  177. /// have a map location.
  178. bc_MapLocation* bc_Location_map_location(bc_Location* this);
  179. /// Whether the unit is in a garrison.
  180. uint8_t bc_Location_is_in_garrison(bc_Location* this);
  181. /// The structure whose garrison the unit is in.
  182. ///
  183. /// * UnitNotInGarrison - the unit is not in a garrison.
  184. uint16_t bc_Location_structure(bc_Location* this);
  185. /// Whether the unit is in space.
  186. uint8_t bc_Location_is_in_space(bc_Location* this);
  187. /// Determines whether this location is adjacent to the specified location,
  188. /// including diagonally. Note that squares are not adjacent to themselves,
  189. /// and squares on different planets are not adjacent to each other. Also,
  190. /// nothing is adjacent to something not on a map.
  191. uint8_t bc_Location_is_adjacent_to(bc_Location* this, bc_Location* o);
  192. /// Whether this location is within the distance squared range of the
  193. /// specified location, inclusive. False for locations on different planets.
  194. /// Note that nothing is within the range of something not on the map.
  195. uint8_t bc_Location_is_within_range(bc_Location* this, uint32_t range, bc_Location* o);
  196. /// Create a human-readable representation of a Location
  197. char* bc_Location_debug(bc_Location* this);
  198. /// Deep-copy a Location
  199. bc_Location* bc_Location_clone(bc_Location* this);
  200. /// Compare two Locations for deep equality.
  201. uint8_t bc_Location_eq(bc_Location* this, bc_Location* other);
  202. /// Deserialize a Location from a JSON string
  203. bc_Location* bc_Location_from_json(char* s);
  204. /// Serialize a Location to a JSON string
  205. char* bc_Location_to_json(bc_Location* this);
  206. ///
  207. typedef enum bc_Team {
  208. Red = 0,
  209. Blue = 1,
  210. } bc_Team;
  211. /// Deserialize a Team from a JSON string
  212. bc_Team bc_Team_from_json(char* s);
  213.  
  214. /// Serialize a Team to a JSON string
  215. char* bc_Team_to_json(bc_Team this);
  216. ///
  217. typedef struct bc_Player bc_Player;
  218. ///
  219. bc_Player* new_bc_Player(bc_Team team, bc_Planet planet);
  220. ///
  221. void delete_bc_Player(bc_Player* this);
  222. ///
  223. bc_Team bc_Player_team_get(bc_Player* this);
  224. ///
  225. bc_Planet bc_Player_planet_get(bc_Player* this);
  226. ///
  227. void bc_Player_team_set(bc_Player* this, bc_Team team);
  228. ///
  229. void bc_Player_planet_set(bc_Player* this, bc_Planet planet);
  230. /// Create a human-readable representation of a Player
  231. char* bc_Player_debug(bc_Player* this);
  232. /// Deep-copy a Player
  233. bc_Player* bc_Player_clone(bc_Player* this);
  234. /// Compare two Players for deep equality.
  235. uint8_t bc_Player_eq(bc_Player* this, bc_Player* other);
  236. /// Deserialize a Player from a JSON string
  237. bc_Player* bc_Player_from_json(char* s);
  238. /// Serialize a Player to a JSON string
  239. char* bc_Player_to_json(bc_Player* this);
  240. /// An immutable list of bc::unit::UnitID objects
  241. typedef struct bc_VecUnitID bc_VecUnitID;
  242. /// An immutable list of bc::unit::UnitID objects
  243. bc_VecUnitID* new_bc_VecUnitID();
  244. ///
  245. void delete_bc_VecUnitID(bc_VecUnitID* this);
  246. /// Create a human-readable representation of a VecUnitID
  247. char* bc_VecUnitID_debug(bc_VecUnitID* this);
  248. /// Deep-copy a VecUnitID
  249. bc_VecUnitID* bc_VecUnitID_clone(bc_VecUnitID* this);
  250. /// The length of the vector.
  251. uintptr_t bc_VecUnitID_len(bc_VecUnitID* this);
  252. /// Copy an element out of the vector.
  253. uint16_t bc_VecUnitID_index(bc_VecUnitID* this, uintptr_t index);
  254. /// The different unit types, which include factories, rockets, and the robots.
  255. typedef enum bc_UnitType {
  256. Worker = 0,
  257. Knight = 1,
  258. Ranger = 2,
  259. Mage = 3,
  260. Healer = 4,
  261. Factory = 5,
  262. Rocket = 6,
  263. } bc_UnitType;
  264. /// Deserialize a UnitType from a JSON string
  265. bc_UnitType bc_UnitType_from_json(char* s);
  266.  
  267. /// Serialize a UnitType to a JSON string
  268. char* bc_UnitType_to_json(bc_UnitType this);
  269.  
  270. /// The cost of the unit in a factory.
  271. ///
  272. /// * InappropriateUnitType - the unit type cannot be produced in a factory.
  273. uint32_t bc_UnitType_factory_cost(bc_UnitType this);
  274.  
  275. /// The cost to blueprint the unit.
  276. ///
  277. /// * InappropriateUnitType - the unit type cannot be blueprinted.
  278. uint32_t bc_UnitType_blueprint_cost(bc_UnitType this);
  279.  
  280. /// The cost to replicate the unit.
  281. ///
  282. /// * InappropriateUnitType - the unit type is not a worker.
  283. uint32_t bc_UnitType_replicate_cost(bc_UnitType this);
  284.  
  285. /// The value of a unit, as relevant to tiebreakers.
  286. uint32_t bc_UnitType_value(bc_UnitType this);
  287. /// An immutable list of bc::unit::UnitType objects
  288. typedef struct bc_VecUnitType bc_VecUnitType;
  289. /// An immutable list of bc::unit::UnitType objects
  290. bc_VecUnitType* new_bc_VecUnitType();
  291. ///
  292. void delete_bc_VecUnitType(bc_VecUnitType* this);
  293. /// Create a human-readable representation of a VecUnitType
  294. char* bc_VecUnitType_debug(bc_VecUnitType* this);
  295. /// Deep-copy a VecUnitType
  296. bc_VecUnitType* bc_VecUnitType_clone(bc_VecUnitType* this);
  297. /// The length of the vector.
  298. uintptr_t bc_VecUnitType_len(bc_VecUnitType* this);
  299. /// Copy an element out of the vector.
  300. bc_UnitType bc_VecUnitType_index(bc_VecUnitType* this, uintptr_t index);
  301. /// A single unit in the game and all its associated properties.
  302. typedef struct bc_Unit bc_Unit;
  303. /// A single unit in the game and all its associated properties.
  304. bc_Unit* new_bc_Unit();
  305. ///
  306. void delete_bc_Unit(bc_Unit* this);
  307. /// Create a human-readable representation of a Unit
  308. char* bc_Unit_debug(bc_Unit* this);
  309. /// Deep-copy a Unit
  310. bc_Unit* bc_Unit_clone(bc_Unit* this);
  311. /// Deserialize a Unit from a JSON string
  312. bc_Unit* bc_Unit_from_json(char* s);
  313. /// Serialize a Unit to a JSON string
  314. char* bc_Unit_to_json(bc_Unit* this);
  315. /// Compare two Units for deep equality.
  316. uint8_t bc_Unit_eq(bc_Unit* this, bc_Unit* other);
  317. /// The unique ID of a unit.
  318. uint16_t bc_Unit_id(bc_Unit* this);
  319. /// The team the unit belongs to.
  320. bc_Team bc_Unit_team(bc_Unit* this);
  321. /// The current research level.
  322. uintptr_t bc_Unit_research_level(bc_Unit* this);
  323. /// The unit type.
  324. bc_UnitType bc_Unit_unit_type(bc_Unit* this);
  325. /// The location of the unit.
  326. bc_Location* bc_Unit_location(bc_Unit* this);
  327. /// The current health.
  328. uint32_t bc_Unit_health(bc_Unit* this);
  329. /// The maximum health.
  330. uint32_t bc_Unit_max_health(bc_Unit* this);
  331. /// The unit vision range.
  332. uint32_t bc_Unit_vision_range(bc_Unit* this);
  333. /// The damage inflicted by the robot during a normal attack.
  334. ///
  335. /// * InappropriateUnitType - the unit is not a robot.
  336. int32_t bc_Unit_damage(bc_Unit* this);
  337. /// The attack range.
  338. ///
  339. /// * InappropriateUnitType - the unit is not a robot.
  340. uint32_t bc_Unit_attack_range(bc_Unit* this);
  341. /// The movement heat.
  342. ///
  343. /// * InappropriateUnitType - the unit is not a robot.
  344. uint32_t bc_Unit_movement_heat(bc_Unit* this);
  345. /// The attack heat.
  346. ///
  347. /// * InappropriateUnitType - the unit is not a robot.
  348. uint32_t bc_Unit_attack_heat(bc_Unit* this);
  349. /// The movement cooldown.
  350. ///
  351. /// * InappropriateUnitType - the unit is not a robot.
  352. uint32_t bc_Unit_movement_cooldown(bc_Unit* this);
  353. /// The attack cooldown.
  354. ///
  355. /// * InappropriateUnitType - the unit is not a robot.
  356. uint32_t bc_Unit_attack_cooldown(bc_Unit* this);
  357. /// Whether the active ability is unlocked.
  358. ///
  359. /// * InappropriateUnitType - the unit is not a robot.
  360. uint8_t bc_Unit_is_ability_unlocked(bc_Unit* this);
  361. /// The active ability heat.
  362. ///
  363. /// * InappropriateUnitType - the unit is not a robot.
  364. uint32_t bc_Unit_ability_heat(bc_Unit* this);
  365. /// The active ability cooldown.
  366. ///
  367. /// * InappropriateUnitType - the unit is not a robot.
  368. uint32_t bc_Unit_ability_cooldown(bc_Unit* this);
  369. /// The active ability range. This is the range in which: workers can replicate, knights can javelin, rangers can snipe, mages can blink, and healers can overcharge.
  370. ///
  371. /// * InappropriateUnitType - the unit is not a robot.
  372. uint32_t bc_Unit_ability_range(bc_Unit* this);
  373. /// Whether the worker has already acted (harveted, blueprinted, built, or repaired) this round.
  374. ///
  375. /// * InappropriateUnitType - the unit is not a worker.
  376. uint8_t bc_Unit_worker_has_acted(bc_Unit* this);
  377. /// The health restored when building a structure.
  378. ///
  379. /// * InappropriateUnitType - the unit is not a worker.
  380. uint32_t bc_Unit_worker_build_health(bc_Unit* this);
  381. /// The health restored when repairing a structure.
  382. ///
  383. /// * InappropriateUnitType - the unit is not a worker.
  384. uint32_t bc_Unit_worker_repair_health(bc_Unit* this);
  385. /// The maximum amount of karbonite harvested from a deposit in one turn.
  386. ///
  387. /// * InappropriateUnitType - the unit is not a worker.
  388. uint32_t bc_Unit_worker_harvest_amount(bc_Unit* this);
  389. /// The amount of damage resisted by a knight when attacked.
  390. ///
  391. /// * InappropriateUnitType - the unit is not a knight.
  392. uint32_t bc_Unit_knight_defense(bc_Unit* this);
  393. /// The range within a ranger cannot attack.
  394. ///
  395. /// * InappropriateUnitType - the unit is not a ranger.
  396. uint32_t bc_Unit_ranger_cannot_attack_range(bc_Unit* this);
  397. /// The maximum countdown for ranger's snipe, which is the number of turns that must pass before the snipe is executed.
  398. ///
  399. /// * InappropriateUnitType - the unit is not a ranger.
  400. uint32_t bc_Unit_ranger_max_countdown(bc_Unit* this);
  401. /// Whether the ranger is sniping.
  402. ///
  403. /// * InappropriateUnitType - the unit is not a ranger.
  404. uint8_t bc_Unit_ranger_is_sniping(bc_Unit* this);
  405. /// The target location for ranger's snipe.
  406. ///
  407. /// * InappropriateUnitType - the unit is not a ranger.
  408. /// * NullValue - the ranger is not sniping.
  409. bc_MapLocation* bc_Unit_ranger_target_location(bc_Unit* this);
  410. /// The countdown for ranger's snipe. Errors if the ranger is not sniping.
  411. ///
  412. /// * InappropriateUnitType - the unit is not a ranger.
  413. /// * NullValue - the ranger is not sniping.
  414. uint32_t bc_Unit_ranger_countdown(bc_Unit* this);
  415. /// The amount of health passively restored to itself each round.
  416. ///
  417. /// * InappropriateUnitType - the unit is not a healer.
  418. uint32_t bc_Unit_healer_self_heal_amount(bc_Unit* this);
  419. /// Whether this structure has been built.
  420. ///
  421. /// * InappropriateUnitType - the unit is not a structure.
  422. uint8_t bc_Unit_structure_is_built(bc_Unit* this);
  423. /// The max capacity of a structure.
  424. ///
  425. /// * InappropriateUnitType - the unit is not a structure.
  426. uintptr_t bc_Unit_structure_max_capacity(bc_Unit* this);
  427. /// Returns the units in the structure's garrison.
  428. ///
  429. /// * InappropriateUnitType - the unit is not a structure.
  430. bc_VecUnitID* bc_Unit_structure_garrison(bc_Unit* this);
  431. /// Whether the factory is currently producing a unit.
  432. ///
  433. /// * InappropriateUnitType - the unit is not a factory.
  434. uint8_t bc_Unit_is_factory_producing(bc_Unit* this);
  435. /// The unit type currently being produced by the factory.
  436. ///
  437. /// * InappropriateUnitType - the unit is not a factory.
  438. /// * NullValue - the factory is not producing.
  439. bc_UnitType bc_Unit_factory_unit_type(bc_Unit* this);
  440. /// The number of rounds left to produce a robot in this factory.
  441. ///
  442. /// * InappropriateUnitType - the unit is not a factory.
  443. /// * NullValue - the factory is not producing.
  444. uint32_t bc_Unit_factory_rounds_left(bc_Unit* this);
  445. /// The maximum number of rounds left to produce a robot in this factory.
  446. ///
  447. /// * InappropriateUnitType - the unit is not a factory.
  448. uint32_t bc_Unit_factory_max_rounds_left(bc_Unit* this);
  449. /// Whether the rocket has already been used.
  450. ///
  451. /// * InappropriateUnitType - the unit is not a rocket.
  452. uint8_t bc_Unit_rocket_is_used(bc_Unit* this);
  453. /// The damage a rocket deals to adjacent units upon landing.
  454. ///
  455. /// * InappropriateUnitType - the unit is not a rocket.
  456. int32_t bc_Unit_rocket_blast_damage(bc_Unit* this);
  457. /// The number of rounds the rocket travel time is reduced by compared to the travel time determined by the orbit of the planets.
  458. ///
  459. /// * InappropriateUnitType - the unit is not a rocket.
  460. uint32_t bc_Unit_rocket_travel_time_decrease(bc_Unit* this);
  461. /// An immutable list of bc::unit::Unit objects
  462. typedef struct bc_VecUnit bc_VecUnit;
  463. /// An immutable list of bc::unit::Unit objects
  464. bc_VecUnit* new_bc_VecUnit();
  465. ///
  466. void delete_bc_VecUnit(bc_VecUnit* this);
  467. /// Create a human-readable representation of a VecUnit
  468. char* bc_VecUnit_debug(bc_VecUnit* this);
  469. /// Deep-copy a VecUnit
  470. bc_VecUnit* bc_VecUnit_clone(bc_VecUnit* this);
  471. /// The length of the vector.
  472. uintptr_t bc_VecUnit_len(bc_VecUnit* this);
  473. /// Copy an element out of the vector.
  474. bc_Unit* bc_VecUnit_index(bc_VecUnit* this, uintptr_t index);
  475. /// The map for one of the planets in the Battlecode world. This information defines the terrain, dimensions, and initial units of the planet.
  476. typedef struct bc_PlanetMap bc_PlanetMap;
  477. /// The map for one of the planets in the Battlecode world. This information defines the terrain, dimensions, and initial units of the planet.
  478. bc_PlanetMap* new_bc_PlanetMap();
  479. ///
  480. void delete_bc_PlanetMap(bc_PlanetMap* this);
  481. /// The planet of the map.
  482. bc_Planet bc_PlanetMap_planet_get(bc_PlanetMap* this);
  483. /// The height of this map, in squares. Must be in the range [MAP_HEIGHT_MIN, MAP_HEIGHT_MAX], inclusive.
  484. uintptr_t bc_PlanetMap_height_get(bc_PlanetMap* this);
  485. /// The height of this map, in squares. Must be in the range [MAP_WIDTH_MIN, MAP_WIDTH_MAX], inclusive.
  486. uintptr_t bc_PlanetMap_width_get(bc_PlanetMap* this);
  487. /// The initial units on the map. Each team starts with 1 to 3 Workers on Earth.
  488. bc_VecUnit* bc_PlanetMap_initial_units_get(bc_PlanetMap* this);
  489. /// The planet of the map.
  490. void bc_PlanetMap_planet_set(bc_PlanetMap* this, bc_Planet planet);
  491. /// The height of this map, in squares. Must be in the range [MAP_HEIGHT_MIN, MAP_HEIGHT_MAX], inclusive.
  492. void bc_PlanetMap_height_set(bc_PlanetMap* this, uintptr_t height);
  493. /// The height of this map, in squares. Must be in the range [MAP_WIDTH_MIN, MAP_WIDTH_MAX], inclusive.
  494. void bc_PlanetMap_width_set(bc_PlanetMap* this, uintptr_t width);
  495. /// The initial units on the map. Each team starts with 1 to 3 Workers on Earth.
  496. void bc_PlanetMap_initial_units_set(bc_PlanetMap* this, bc_VecUnit* initial_units);
  497. /// Validates the map and checks some invariants are followed.
  498. ///
  499. /// * InvalidMapObject - the planet map is invalid.
  500. void bc_PlanetMap_validate(bc_PlanetMap* this);
  501. /// Whether a location is on the map.
  502. uint8_t bc_PlanetMap_on_map(bc_PlanetMap* this, bc_MapLocation* location);
  503. ///
  504. /// Whether the location on the map contains passable terrain. Is only false when the square contains impassable terrain (distinct from containing a building, for instance).
  505. ///
  506. /// LocationOffMap - the location is off the map.
  507. uint8_t bc_PlanetMap_is_passable_terrain_at(bc_PlanetMap* this, bc_MapLocation* location);
  508. /// The amount of Karbonite initially deposited at the given location.
  509. ///
  510. /// LocationOffMap - the location is off the map.
  511. uint32_t bc_PlanetMap_initial_karbonite_at(bc_PlanetMap* this, bc_MapLocation* location);
  512. /// Deep-copy a PlanetMap
  513. bc_PlanetMap* bc_PlanetMap_clone(bc_PlanetMap* this);
  514. /// Deserialize a PlanetMap from a JSON string
  515. bc_PlanetMap* bc_PlanetMap_from_json(char* s);
  516. /// Serialize a PlanetMap to a JSON string
  517. char* bc_PlanetMap_to_json(bc_PlanetMap* this);
  518. ///
  519. typedef struct bc_Delta bc_Delta;
  520. ///
  521. bc_Delta* new_bc_Delta();
  522. ///
  523. void delete_bc_Delta(bc_Delta* this);
  524. /// Deserialize a Delta from a JSON string
  525. bc_Delta* bc_Delta_from_json(char* s);
  526. /// Serialize a Delta to a JSON string
  527. char* bc_Delta_to_json(bc_Delta* this);
  528. ///
  529. typedef struct bc_StartGameMessage bc_StartGameMessage;
  530. ///
  531. bc_StartGameMessage* new_bc_StartGameMessage();
  532. ///
  533. void delete_bc_StartGameMessage(bc_StartGameMessage* this);
  534. /// Deserialize a StartGameMessage from a JSON string
  535. bc_StartGameMessage* bc_StartGameMessage_from_json(char* s);
  536. /// Serialize a StartGameMessage to a JSON string
  537. char* bc_StartGameMessage_to_json(bc_StartGameMessage* this);
  538. ///
  539. typedef struct bc_TurnMessage bc_TurnMessage;
  540. ///
  541. bc_TurnMessage* new_bc_TurnMessage();
  542. ///
  543. void delete_bc_TurnMessage(bc_TurnMessage* this);
  544. /// Deserialize a TurnMessage from a JSON string
  545. bc_TurnMessage* bc_TurnMessage_from_json(char* s);
  546. /// Serialize a TurnMessage to a JSON string
  547. char* bc_TurnMessage_to_json(bc_TurnMessage* this);
  548. ///
  549. typedef struct bc_StartTurnMessage bc_StartTurnMessage;
  550. ///
  551. bc_StartTurnMessage* new_bc_StartTurnMessage();
  552. ///
  553. void delete_bc_StartTurnMessage(bc_StartTurnMessage* this);
  554. ///
  555. uint32_t bc_StartTurnMessage_round_get(bc_StartTurnMessage* this);
  556. ///
  557. void bc_StartTurnMessage_round_set(bc_StartTurnMessage* this, uint32_t round);
  558. /// Deserialize a StartTurnMessage from a JSON string
  559. bc_StartTurnMessage* bc_StartTurnMessage_from_json(char* s);
  560. /// Serialize a StartTurnMessage to a JSON string
  561. char* bc_StartTurnMessage_to_json(bc_StartTurnMessage* this);
  562. ///
  563. typedef struct bc_ViewerMessage bc_ViewerMessage;
  564. ///
  565. bc_ViewerMessage* new_bc_ViewerMessage();
  566. ///
  567. void delete_bc_ViewerMessage(bc_ViewerMessage* this);
  568. /// Deserialize a ViewerMessage from a JSON string
  569. bc_ViewerMessage* bc_ViewerMessage_from_json(char* s);
  570. /// Serialize a ViewerMessage to a JSON string
  571. char* bc_ViewerMessage_to_json(bc_ViewerMessage* this);
  572. ///
  573. typedef struct bc_ViewerKeyframe bc_ViewerKeyframe;
  574. ///
  575. bc_ViewerKeyframe* new_bc_ViewerKeyframe();
  576. ///
  577. void delete_bc_ViewerKeyframe(bc_ViewerKeyframe* this);
  578. /// Deserialize a ViewerKeyframe from a JSON string
  579. bc_ViewerKeyframe* bc_ViewerKeyframe_from_json(char* s);
  580. /// Serialize a ViewerKeyframe to a JSON string
  581. char* bc_ViewerKeyframe_to_json(bc_ViewerKeyframe* this);
  582. ///
  583. typedef struct bc_ErrorMessage bc_ErrorMessage;
  584. ///
  585. bc_ErrorMessage* new_bc_ErrorMessage();
  586. ///
  587. void delete_bc_ErrorMessage(bc_ErrorMessage* this);
  588. ///
  589. char* bc_ErrorMessage_error_get(bc_ErrorMessage* this);
  590. ///
  591. void bc_ErrorMessage_error_set(bc_ErrorMessage* this, char* error);
  592. /// Deserialize a ErrorMessage from a JSON string
  593. bc_ErrorMessage* bc_ErrorMessage_from_json(char* s);
  594. /// Serialize a ErrorMessage to a JSON string
  595. char* bc_ErrorMessage_to_json(bc_ErrorMessage* this);
  596. /// Create a human-readable representation of a ErrorMessage
  597. char* bc_ErrorMessage_debug(bc_ErrorMessage* this);
  598. ///
  599. typedef struct bc_TurnApplication bc_TurnApplication;
  600. ///
  601. bc_TurnApplication* new_bc_TurnApplication();
  602. ///
  603. void delete_bc_TurnApplication(bc_TurnApplication* this);
  604. ///
  605. bc_StartTurnMessage* bc_TurnApplication_start_turn_get(bc_TurnApplication* this);
  606. ///
  607. bc_ViewerMessage* bc_TurnApplication_viewer_get(bc_TurnApplication* this);
  608. ///
  609. void bc_TurnApplication_start_turn_set(bc_TurnApplication* this, bc_StartTurnMessage* start_turn);
  610. ///
  611. void bc_TurnApplication_viewer_set(bc_TurnApplication* this, bc_ViewerMessage* viewer);
  612. ///
  613. typedef struct bc_InitialTurnApplication bc_InitialTurnApplication;
  614. ///
  615. bc_InitialTurnApplication* new_bc_InitialTurnApplication();
  616. ///
  617. void delete_bc_InitialTurnApplication(bc_InitialTurnApplication* this);
  618. ///
  619. bc_StartTurnMessage* bc_InitialTurnApplication_start_turn_get(bc_InitialTurnApplication* this);
  620. ///
  621. bc_ViewerKeyframe* bc_InitialTurnApplication_viewer_get(bc_InitialTurnApplication* this);
  622. ///
  623. void bc_InitialTurnApplication_start_turn_set(bc_InitialTurnApplication* this, bc_StartTurnMessage* start_turn);
  624. ///
  625. void bc_InitialTurnApplication_viewer_set(bc_InitialTurnApplication* this, bc_ViewerKeyframe* viewer);
  626. /// A single asteroid strike on Mars.
  627. typedef struct bc_AsteroidStrike bc_AsteroidStrike;
  628. ///
  629. bc_AsteroidStrike* new_bc_AsteroidStrike(uint32_t karbonite, bc_MapLocation* location);
  630. ///
  631. void delete_bc_AsteroidStrike(bc_AsteroidStrike* this);
  632. ///
  633. uint32_t bc_AsteroidStrike_karbonite_get(bc_AsteroidStrike* this);
  634. ///
  635. bc_MapLocation* bc_AsteroidStrike_location_get(bc_AsteroidStrike* this);
  636. ///
  637. void bc_AsteroidStrike_karbonite_set(bc_AsteroidStrike* this, uint32_t karbonite);
  638. ///
  639. void bc_AsteroidStrike_location_set(bc_AsteroidStrike* this, bc_MapLocation* location);
  640. /// Deep-copy a AsteroidStrike
  641. bc_AsteroidStrike* bc_AsteroidStrike_clone(bc_AsteroidStrike* this);
  642. /// Create a human-readable representation of a AsteroidStrike
  643. char* bc_AsteroidStrike_debug(bc_AsteroidStrike* this);
  644. /// Deserialize a AsteroidStrike from a JSON string
  645. bc_AsteroidStrike* bc_AsteroidStrike_from_json(char* s);
  646. /// Serialize a AsteroidStrike to a JSON string
  647. char* bc_AsteroidStrike_to_json(bc_AsteroidStrike* this);
  648. /// Compare two AsteroidStrikes for deep equality.
  649. uint8_t bc_AsteroidStrike_eq(bc_AsteroidStrike* this, bc_AsteroidStrike* other);
  650. /// The asteroid pattern, defined by the timing and contents of each asteroid strike.
  651. typedef struct bc_AsteroidPattern bc_AsteroidPattern;
  652. /// Constructs a pseudorandom asteroid pattern given a map of Mars.
  653. bc_AsteroidPattern* new_bc_AsteroidPattern(uint16_t seed, bc_PlanetMap* mars_map);
  654. ///
  655. void delete_bc_AsteroidPattern(bc_AsteroidPattern* this);
  656. /// Validates the asteroid pattern.
  657. ///
  658. /// * InvalidMapObject - the asteroid pattern is invalid.
  659. void bc_AsteroidPattern_validate(bc_AsteroidPattern* this);
  660. /// Whether there is an asteroid strike at the given round.
  661. uint8_t bc_AsteroidPattern_has_asteroid(bc_AsteroidPattern* this, uint32_t round);
  662. /// Get the asteroid strike at the given round.
  663. ///
  664. /// * NullValue - There is no asteroid strike at this round.
  665. bc_AsteroidStrike* bc_AsteroidPattern_asteroid(bc_AsteroidPattern* this, uint32_t round);
  666. /// Deep-copy a AsteroidPattern
  667. bc_AsteroidPattern* bc_AsteroidPattern_clone(bc_AsteroidPattern* this);
  668. /// Create a human-readable representation of a AsteroidPattern
  669. char* bc_AsteroidPattern_debug(bc_AsteroidPattern* this);
  670. /// Deserialize a AsteroidPattern from a JSON string
  671. bc_AsteroidPattern* bc_AsteroidPattern_from_json(char* s);
  672. /// Serialize a AsteroidPattern to a JSON string
  673. char* bc_AsteroidPattern_to_json(bc_AsteroidPattern* this);
  674. /// The orbit pattern that determines a rocket's flight duration. This pattern is a sinusoidal function y=a*sin(bx)+c.
  675. typedef struct bc_OrbitPattern bc_OrbitPattern;
  676. /// Construct a new orbit pattern. This pattern is a sinusoidal function y=a*sin(bx)+c, where the x-axis is the round number of takeoff and the the y-axis is the duration of flight to the nearest integer.
  677. ///
  678. /// The amplitude, period, and center are measured in rounds.
  679. bc_OrbitPattern* new_bc_OrbitPattern(uint32_t amplitude, uint32_t period, uint32_t center);
  680. ///
  681. void delete_bc_OrbitPattern(bc_OrbitPattern* this);
  682. /// Amplitude of the orbit.
  683. uint32_t bc_OrbitPattern_amplitude_get(bc_OrbitPattern* this);
  684. /// The period of the orbit.
  685. uint32_t bc_OrbitPattern_period_get(bc_OrbitPattern* this);
  686. /// The center of the orbit.
  687. uint32_t bc_OrbitPattern_center_get(bc_OrbitPattern* this);
  688. /// Amplitude of the orbit.
  689. void bc_OrbitPattern_amplitude_set(bc_OrbitPattern* this, uint32_t amplitude);
  690. /// The period of the orbit.
  691. void bc_OrbitPattern_period_set(bc_OrbitPattern* this, uint32_t period);
  692. /// The center of the orbit.
  693. void bc_OrbitPattern_center_set(bc_OrbitPattern* this, uint32_t center);
  694. /// Validates the orbit pattern.
  695. ///
  696. /// * InvalidMapObject - the orbit pattern is invalid.
  697. void bc_OrbitPattern_validate(bc_OrbitPattern* this);
  698. /// Get the duration of flight if the rocket were to take off from either planet on the given round.
  699. uint32_t bc_OrbitPattern_duration(bc_OrbitPattern* this, uint32_t round);
  700. /// Deserialize a OrbitPattern from a JSON string
  701. bc_OrbitPattern* bc_OrbitPattern_from_json(char* s);
  702. /// Serialize a OrbitPattern to a JSON string
  703. char* bc_OrbitPattern_to_json(bc_OrbitPattern* this);
  704. /// The map defining the starting state for an entire game.
  705. typedef struct bc_GameMap bc_GameMap;
  706. /// The map defining the starting state for an entire game.
  707. bc_GameMap* new_bc_GameMap();
  708. ///
  709. void delete_bc_GameMap(bc_GameMap* this);
  710. /// Seed for random number generation.
  711. uint16_t bc_GameMap_seed_get(bc_GameMap* this);
  712. /// Earth map.
  713. bc_PlanetMap* bc_GameMap_earth_map_get(bc_GameMap* this);
  714. /// Mars map.
  715. bc_PlanetMap* bc_GameMap_mars_map_get(bc_GameMap* this);
  716. /// The asteroid strike pattern on Mars.
  717. bc_AsteroidPattern* bc_GameMap_asteroids_get(bc_GameMap* this);
  718. /// The orbit pattern that determines a rocket's flight duration.
  719. bc_OrbitPattern* bc_GameMap_orbit_get(bc_GameMap* this);
  720. /// Seed for random number generation.
  721. void bc_GameMap_seed_set(bc_GameMap* this, uint16_t seed);
  722. /// Earth map.
  723. void bc_GameMap_earth_map_set(bc_GameMap* this, bc_PlanetMap* earth_map);
  724. /// Mars map.
  725. void bc_GameMap_mars_map_set(bc_GameMap* this, bc_PlanetMap* mars_map);
  726. /// The asteroid strike pattern on Mars.
  727. void bc_GameMap_asteroids_set(bc_GameMap* this, bc_AsteroidPattern* asteroids);
  728. /// The orbit pattern that determines a rocket's flight duration.
  729. void bc_GameMap_orbit_set(bc_GameMap* this, bc_OrbitPattern* orbit);
  730. /// Validate the game map.
  731. ///
  732. /// * InvalidMapObject - the game map is invalid.
  733. void bc_GameMap_validate(bc_GameMap* this);
  734. ///
  735. bc_GameMap* bc_GameMap_test_map();
  736. /// Deep-copy a GameMap
  737. bc_GameMap* bc_GameMap_clone(bc_GameMap* this);
  738. /// Deserialize a GameMap from a JSON string
  739. bc_GameMap* bc_GameMap_from_json(char* s);
  740. /// Serialize a GameMap to a JSON string
  741. char* bc_GameMap_to_json(bc_GameMap* this);
  742. ///
  743. uintptr_t max_level(bc_UnitType branch);
  744. ///
  745. uint32_t cost_of(bc_UnitType branch, uintptr_t level);
  746. /// The status of research for a single team.
  747. typedef struct bc_ResearchInfo bc_ResearchInfo;
  748. /// Construct an initial research state.
  749. bc_ResearchInfo* new_bc_ResearchInfo();
  750. ///
  751. void delete_bc_ResearchInfo(bc_ResearchInfo* this);
  752. /// Returns the current level of the research branch.
  753. uintptr_t bc_ResearchInfo_get_level(bc_ResearchInfo* this, bc_UnitType branch);
  754. /// Returns the research queue, where the front of the queue is at the beginning of the list.
  755. bc_VecUnitType* bc_ResearchInfo_queue(bc_ResearchInfo* this);
  756. /// Whether there is a branch in the research queue.
  757. uint8_t bc_ResearchInfo_has_next_in_queue(bc_ResearchInfo* this);
  758. /// Returns the next branch to be researched, which is the branch at the front of the research queue.
  759. ///
  760. /// * NullValue - There is no branch to be researched.
  761. bc_UnitType bc_ResearchInfo_next_in_queue(bc_ResearchInfo* this);
  762. /// Returns the number of rounds left until the upgrade at the front of the research queue is applied.
  763. ///
  764. /// * NullValue - There is no branch to be researched.
  765. uint32_t bc_ResearchInfo_rounds_left(bc_ResearchInfo* this);
  766. /// Deserialize a ResearchInfo from a JSON string
  767. bc_ResearchInfo* bc_ResearchInfo_from_json(char* s);
  768. /// Serialize a ResearchInfo to a JSON string
  769. char* bc_ResearchInfo_to_json(bc_ResearchInfo* this);
  770. ///
  771. typedef struct bc_RocketLanding bc_RocketLanding;
  772. ///
  773. bc_RocketLanding* new_bc_RocketLanding(uint16_t rocket_id, bc_MapLocation* destination);
  774. ///
  775. void delete_bc_RocketLanding(bc_RocketLanding* this);
  776. /// The ID of the rocket.
  777. uint16_t bc_RocketLanding_rocket_id_get(bc_RocketLanding* this);
  778. /// The landing destination of the rocket.
  779. bc_MapLocation* bc_RocketLanding_destination_get(bc_RocketLanding* this);
  780. /// The ID of the rocket.
  781. void bc_RocketLanding_rocket_id_set(bc_RocketLanding* this, uint16_t rocket_id);
  782. /// The landing destination of the rocket.
  783. void bc_RocketLanding_destination_set(bc_RocketLanding* this, bc_MapLocation* destination);
  784. /// Deep-copy a RocketLanding
  785. bc_RocketLanding* bc_RocketLanding_clone(bc_RocketLanding* this);
  786. /// Create a human-readable representation of a RocketLanding
  787. char* bc_RocketLanding_debug(bc_RocketLanding* this);
  788. /// Deserialize a RocketLanding from a JSON string
  789. bc_RocketLanding* bc_RocketLanding_from_json(char* s);
  790. /// Serialize a RocketLanding to a JSON string
  791. char* bc_RocketLanding_to_json(bc_RocketLanding* this);
  792. /// Compare two RocketLandings for deep equality.
  793. uint8_t bc_RocketLanding_eq(bc_RocketLanding* this, bc_RocketLanding* other);
  794. /// An immutable list of bc::rockets::RocketLanding objects
  795. typedef struct bc_VecRocketLanding bc_VecRocketLanding;
  796. /// An immutable list of bc::rockets::RocketLanding objects
  797. bc_VecRocketLanding* new_bc_VecRocketLanding();
  798. ///
  799. void delete_bc_VecRocketLanding(bc_VecRocketLanding* this);
  800. /// Create a human-readable representation of a VecRocketLanding
  801. char* bc_VecRocketLanding_debug(bc_VecRocketLanding* this);
  802. /// Deep-copy a VecRocketLanding
  803. bc_VecRocketLanding* bc_VecRocketLanding_clone(bc_VecRocketLanding* this);
  804. /// The length of the vector.
  805. uintptr_t bc_VecRocketLanding_len(bc_VecRocketLanding* this);
  806. /// Copy an element out of the vector.
  807. bc_RocketLanding* bc_VecRocketLanding_index(bc_VecRocketLanding* this, uintptr_t index);
  808. ///
  809. typedef struct bc_RocketLandingInfo bc_RocketLandingInfo;
  810. /// Construct an empty rocket landing info.
  811. bc_RocketLandingInfo* new_bc_RocketLandingInfo();
  812. ///
  813. void delete_bc_RocketLandingInfo(bc_RocketLandingInfo* this);
  814. /// Get the rocket landings on this round.
  815. bc_VecRocketLanding* bc_RocketLandingInfo_landings_on(bc_RocketLandingInfo* this, uint32_t round);
  816. /// Deep-copy a RocketLandingInfo
  817. bc_RocketLandingInfo* bc_RocketLandingInfo_clone(bc_RocketLandingInfo* this);
  818. /// Create a human-readable representation of a RocketLandingInfo
  819. char* bc_RocketLandingInfo_debug(bc_RocketLandingInfo* this);
  820. /// Deserialize a RocketLandingInfo from a JSON string
  821. bc_RocketLandingInfo* bc_RocketLandingInfo_from_json(char* s);
  822. /// Serialize a RocketLandingInfo to a JSON string
  823. char* bc_RocketLandingInfo_to_json(bc_RocketLandingInfo* this);
  824. /// Compare two RocketLandingInfos for deep equality.
  825. uint8_t bc_RocketLandingInfo_eq(bc_RocketLandingInfo* this, bc_RocketLandingInfo* other);
  826. ///
  827. typedef struct bc_GameController bc_GameController;
  828. /// Use environment variables to connect to the manager.
  829. bc_GameController* new_bc_GameController();
  830. ///
  831. void delete_bc_GameController(bc_GameController* this);
  832. /// Send the moves from the current turn and wait for the next turn.
  833. void bc_GameController_next_turn(bc_GameController* this);
  834. /// 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.
  835. uint32_t bc_GameController_round(bc_GameController* this);
  836. /// The current planet.
  837. bc_Planet bc_GameController_planet(bc_GameController* this);
  838. /// The team whose turn it is.
  839. bc_Team bc_GameController_team(bc_GameController* this);
  840. /// The starting map of the given planet. Includes the map's planet, dimensions, impassable terrain, and initial units and karbonite.
  841. bc_PlanetMap* bc_GameController_starting_map(bc_GameController* this, bc_Planet planet);
  842. /// The karbonite in the team's resource pool.
  843. uint32_t bc_GameController_karbonite(bc_GameController* this);
  844. /// 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.
  845. ///
  846. /// * NoSuchUnit - the unit does not exist (inside the vision range).
  847. bc_Unit* bc_GameController_unit(bc_GameController* this, uint16_t id);
  848. /// All the units within the vision range, in no particular order. Does not include units in space.
  849. bc_VecUnit* bc_GameController_units(bc_GameController* this);
  850. /// All the units on your team. Does not include units in space.
  851. bc_VecUnit* bc_GameController_my_units(bc_GameController* this);
  852. /// All the units of this team that are in space. You cannot see units on the other team that are in space.
  853. bc_VecUnit* bc_GameController_units_in_space(bc_GameController* this);
  854. /// The karbonite at the given location.
  855. ///
  856. /// * LocationOffMap - the location is off the map.
  857. /// * LocationNotVisible - the location is outside the vision range.
  858. uint32_t bc_GameController_karbonite_at(bc_GameController* this, bc_MapLocation* location);
  859. /// Returns an array of all locations within a certain radius squared of this location that are on the map.
  860. ///
  861. /// The locations are ordered first by the x-coordinate, then the y-coordinate. The radius squared is inclusive.
  862. bc_VecMapLocation* bc_GameController_all_locations_within(bc_GameController* this, bc_MapLocation* location, uint32_t radius_squared);
  863. /// Whether the location is on the map and within the vision range.
  864. uint8_t bc_GameController_can_sense_location(bc_GameController* this, bc_MapLocation* location);
  865. /// Whether there is a unit with this ID within the vision range.
  866. uint8_t bc_GameController_can_sense_unit(bc_GameController* this, uint16_t id);
  867. /// Sense units near the location within the given radius, inclusive, in distance squared. The units are within the vision range.
  868. bc_VecUnit* bc_GameController_sense_nearby_units(bc_GameController* this, bc_MapLocation* location, uint32_t radius);
  869. /// 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.
  870. bc_VecUnit* bc_GameController_sense_nearby_units_by_team(bc_GameController* this, bc_MapLocation* location, uint32_t radius, bc_Team team);
  871. /// 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.
  872. bc_VecUnit* bc_GameController_sense_nearby_units_by_type(bc_GameController* this, bc_MapLocation* location, uint32_t radius, bc_UnitType unit_type);
  873. /// Whether there is a visible unit at a location.
  874. uint8_t bc_GameController_has_unit_at_location(bc_GameController* this, bc_MapLocation* location);
  875. /// The unit at the location, if it exists.
  876. ///
  877. /// * LocationOffMap - the location is off the map.
  878. /// * LocationNotVisible - the location is outside the vision range.
  879. bc_Unit* bc_GameController_sense_unit_at_location(bc_GameController* this, bc_MapLocation* location);
  880. /// The asteroid strike pattern on Mars.
  881. bc_AsteroidPattern* bc_GameController_asteroid_pattern(bc_GameController* this);
  882. /// The orbit pattern that determines a rocket's flight duration.
  883. bc_OrbitPattern* bc_GameController_orbit_pattern(bc_GameController* this);
  884. /// The current duration of flight if a rocket were to be launched this round. Does not take into account any research done on rockets.
  885. uint32_t bc_GameController_current_duration_of_flight(bc_GameController* this);
  886. /// 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.
  887. bc_Veci32* bc_GameController_get_team_array(bc_GameController* this, bc_Planet planet);
  888. /// Writes the value at the index of this planet's team array.
  889. ///
  890. /// * ArrayOutOfBounds - the index of the array is out of bounds. It must be within [0, COMMUNICATION_ARRAY_LENGTH).
  891. void bc_GameController_write_team_array(bc_GameController* this, uintptr_t index, int32_t value);
  892. /// 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.
  893. ///
  894. /// * NoSuchUnit - the unit does not exist (inside the vision range).
  895. /// * TeamNotAllowed - the unit is not on the current player's team.
  896. void bc_GameController_disintegrate_unit(bc_GameController* this, uint16_t unit_id);
  897. /// Whether the location is clear for a unit to occupy, either by movement or by construction.
  898. ///
  899. /// * LocationOffMap - the location is off the map.
  900. /// * LocationNotVisible - the location is outside the vision range.
  901. uint8_t bc_GameController_is_occupiable(bc_GameController* this, bc_MapLocation* location);
  902. /// 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.
  903. uint8_t bc_GameController_can_move(bc_GameController* this, uint16_t robot_id, bc_Direction direction);
  904. /// Whether the robot is ready to move. Tests whether the robot's attack heat is sufficiently low.
  905. uint8_t bc_GameController_is_move_ready(bc_GameController* this, uint16_t robot_id);
  906. /// Moves the robot in the given direction.
  907. ///
  908. /// * NoSuchUnit - the robot does not exist (within the vision range).
  909. /// * TeamNotAllowed - the robot is not on the current player's team.
  910. /// * UnitNotOnMap - the robot is not on the map.
  911. /// * LocationNotVisible - the location is outside the vision range.
  912. /// * LocationOffMap - the location is off the map.
  913. /// * LocationNotEmpty - the location is occupied by a unit or terrain.
  914. /// * Overheated - the robot is not ready to move again.
  915. void bc_GameController_move_robot(bc_GameController* this, uint16_t robot_id, bc_Direction direction);
  916. /// 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.
  917. ///
  918. /// Healers cannot attack, and should use can_heal() instead.
  919. uint8_t bc_GameController_can_attack(bc_GameController* this, uint16_t robot_id, uint16_t target_unit_id);
  920. /// Whether the robot is ready to attack. Tests whether the robot's attack heat is sufficiently low.
  921. ///
  922. /// Healers cannot attack, and should use is_heal_ready() instead.
  923. uint8_t bc_GameController_is_attack_ready(bc_GameController* this, uint16_t robot_id);
  924. /// Commands a robot to attack a unit, dealing the robot's standard amount of damage.
  925. ///
  926. /// Healers cannot attack, and should use heal() instead.
  927. ///
  928. /// * NoSuchUnit - the unit does not exist (inside the vision range).
  929. /// * TeamNotAllowed - the unit is not on the current player's team.
  930. /// * InappropriateUnitType - the unit is not a robot, or is a healer.
  931. /// * UnitNotOnMap - the unit or target is not on the map.
  932. /// * OutOfRange - the target location is not in range.
  933. /// * Overheated - the unit is not ready to attack.
  934. void bc_GameController_attack(bc_GameController* this, uint16_t robot_id, uint16_t target_unit_id);
  935. /// The research info of the current team, including what branch is currently being researched, the number of rounds left.
  936. bc_ResearchInfo* bc_GameController_research_info(bc_GameController* this);
  937. /// Resets the research queue to be empty. Returns true if the queue was not empty before, and false otherwise.
  938. uint8_t bc_GameController_reset_research(bc_GameController* this);
  939. /// 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.
  940. ///
  941. /// Returns whether the branch was successfully added.
  942. uint8_t bc_GameController_queue_research(bc_GameController* this, bc_UnitType branch);
  943. /// 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.
  944. uint8_t bc_GameController_can_harvest(bc_GameController* this, uint16_t worker_id, bc_Direction direction);
  945. /// Harvests up to the worker's harvest amount of karbonite from the given location, adding it to the team's resource pool.
  946. ///
  947. /// * NoSuchUnit - the worker does not exist (within the vision range).
  948. /// * TeamNotAllowed - the worker is not on the current player's team.
  949. /// * InappropriateUnitType - the unit is not a worker.
  950. /// * Overheated - the worker has already performed an action this turn.
  951. /// * UnitNotOnMap - the worker is not on the map.
  952. /// * LocationOffMap - the location in the target direction is off the map.
  953. /// * LocationNotVisible - the location is not in the vision range.
  954. /// * KarboniteDepositEmpty - the location described contains no Karbonite.
  955. void bc_GameController_harvest(bc_GameController* this, uint16_t worker_id, bc_Direction direction);
  956. /// 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.
  957. uint8_t bc_GameController_can_blueprint(bc_GameController* this, uint16_t worker_id, bc_UnitType unit_type, bc_Direction direction);
  958. /// Blueprints a unit of the given type in the given direction. Subtract cost of that unit from the team's resource pool.
  959. ///
  960. /// * NoSuchUnit - the worker does not exist (within the vision range).
  961. /// * TeamNotAllowed - the worker is not on the current player's team.
  962. /// * InappropriateUnitType - the unit is not a worker, or the unit type is not a structure.
  963. /// * Overheated - the worker has already performed an action this turn.
  964. /// * UnitNotOnMap - the unit is not on the map.
  965. /// * LocationOffMap - the location in the target direction is off the map.
  966. /// * LocationNotVisible - the location is outside the vision range.
  967. /// * LocationNotEmpty - the location in the target direction is already occupied.
  968. /// * CannotBuildOnMars - you cannot blueprint a structure on Mars.
  969. /// * ResearchNotUnlocked - you do not have the needed research to blueprint rockets.
  970. /// * InsufficientKarbonite - your team does not have enough Karbonite to build the requested structure.
  971. void bc_GameController_blueprint(bc_GameController* this, uint16_t worker_id, bc_UnitType structure_type, bc_Direction direction);
  972. /// 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.
  973. uint8_t bc_GameController_can_build(bc_GameController* this, uint16_t worker_id, uint16_t blueprint_id);
  974. /// Builds a given blueprint, increasing its health by the worker's build amount. If raised to maximum health, the blueprint becomes a completed structure.
  975. ///
  976. /// * NoSuchUnit - either unit does not exist (within the vision range).
  977. /// * TeamNotAllowed - either unit is not on the current player's team.
  978. /// * UnitNotOnMap - the worker is not on the map.
  979. /// * InappropriateUnitType - the unit is not a worker, or the blueprint is not a structure.
  980. /// * Overheated - the worker has already performed an action this turn.
  981. /// * OutOfRange - the worker is not adjacent to the blueprint.
  982. /// * StructureAlreadyBuilt - the blueprint has already been completed.
  983. void bc_GameController_build(bc_GameController* this, uint16_t worker_id, uint16_t blueprint_id);
  984. /// 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.
  985. uint8_t bc_GameController_can_repair(bc_GameController* this, uint16_t worker_id, uint16_t structure_id);
  986. /// Commands the worker to repair a structure, repleneshing health to it. This can only be done to structures which have been fully built.
  987. ///
  988. /// * NoSuchUnit - either unit does not exist (within the vision range).
  989. /// * TeamNotAllowed - either unit is not on the current player's team.
  990. /// * UnitNotOnMap - the worker is not on the map.
  991. /// * InappropriateUnitType - the unit is not a worker, or the target is not a structure.
  992. /// * Overheated - the worker has already performed an action this turn.
  993. /// * OutOfRange - the worker is not adjacent to the structure.
  994. /// * StructureNotYetBuilt - the structure has not been completed.
  995. void bc_GameController_repair(bc_GameController* this, uint16_t worker_id, uint16_t structure_id);
  996. /// 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.
  997. uint8_t bc_GameController_can_replicate(bc_GameController* this, uint16_t worker_id, bc_Direction direction);
  998. /// Replicates a worker in the given direction. Subtracts the cost of the worker from the team's resource pool.
  999. ///
  1000. /// * NoSuchUnit - the worker does not exist (within the vision range).
  1001. /// * TeamNotAllowed - the worker is not on the current player's team.
  1002. /// * InappropriateUnitType - the unit is not a worker.
  1003. /// * Overheated - the worker is not ready to replicate again.
  1004. /// * InsufficientKarbonite - your team does not have enough Karbonite for the worker to replicate.
  1005. /// * UnitNotOnMap - the worker is not on the map.
  1006. /// * LocationOffMap - the location in the target direction is off the map.
  1007. /// * LocationNotVisible - the location is outside the vision range.
  1008. /// * LocationNotEmpty - the location in the target direction is already occupied.
  1009. void bc_GameController_replicate(bc_GameController* this, uint16_t worker_id, bc_Direction direction);
  1010. /// 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.
  1011. uint8_t bc_GameController_can_javelin(bc_GameController* this, uint16_t knight_id, uint16_t target_unit_id);
  1012. /// Whether the knight is ready to javelin. Tests whether the knight's ability heat is sufficiently low.
  1013. uint8_t bc_GameController_is_javelin_ready(bc_GameController* this, uint16_t knight_id);
  1014. /// Javelins the robot, dealing the knight's standard damage.
  1015. ///
  1016. /// * NoSuchUnit - either unit does not exist (inside the vision range).
  1017. /// * TeamNotAllowed - the knight is not on the current player's team.
  1018. /// * UnitNotOnMap - the knight is not on the map.
  1019. /// * InappropriateUnitType - the unit is not a knight.
  1020. /// * ResearchNotUnlocked - you do not have the needed research to use javelin.
  1021. /// * OutOfRange - the target does not lie within ability range of the knight.
  1022. /// * Overheated - the knight is not ready to use javelin again.
  1023. void bc_GameController_javelin(bc_GameController* this, uint16_t knight_id, uint16_t target_unit_id);
  1024. /// 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.
  1025. uint8_t bc_GameController_can_begin_snipe(bc_GameController* this, uint16_t ranger_id, bc_MapLocation* location);
  1026. /// Whether the ranger is ready to begin snipe. Tests whether the ranger's ability heat is sufficiently low.
  1027. uint8_t bc_GameController_is_begin_snipe_ready(bc_GameController* this, uint16_t ranger_id);
  1028. /// 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.
  1029. ///
  1030. /// * NoSuchUnit - either unit does not exist (inside the vision range).
  1031. /// * TeamNotAllowed - the ranger is not on the current player's team.
  1032. /// * UnitNotOnMap - the ranger is not on the map.
  1033. /// * InappropriateUnitType - the unit is not a ranger.
  1034. /// * ResearchNotUnlocked - you do not have the needed research to use snipe.
  1035. /// * Overheated - the ranger is not ready to use snipe again.
  1036. void bc_GameController_begin_snipe(bc_GameController* this, uint16_t ranger_id, bc_MapLocation* location);
  1037. /// 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.
  1038. uint8_t bc_GameController_can_blink(bc_GameController* this, uint16_t mage_id, bc_MapLocation* location);
  1039. /// Whether the mage is ready to blink. Tests whether the mage's ability heat is sufficiently low.
  1040. uint8_t bc_GameController_is_blink_ready(bc_GameController* this, uint16_t mage_id);
  1041. /// Blinks the mage to the given location.
  1042. ///
  1043. /// * NoSuchUnit - the mage does not exist (inside the vision range).
  1044. /// * TeamNotAllowed - the mage is not on the current player's team.
  1045. /// * UnitNotOnMap - the mage is not on the map.
  1046. /// * InappropriateUnitType - the unit is not a mage.
  1047. /// * ResearchNotUnlocked - you do not have the needed research to use blink.
  1048. /// * OutOfRange - the target does not lie within ability range of the mage.
  1049. /// * LocationOffMap - the target location is not on this planet's map.
  1050. /// * LocationNotVisible - the target location is outside the vision range.
  1051. /// * LocationNotEmpty - the target location is already occupied.
  1052. /// * Overheated - the mage is not ready to use blink again.
  1053. void bc_GameController_blink(bc_GameController* this, uint16_t mage_id, bc_MapLocation* location);
  1054. /// 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.
  1055. uint8_t bc_GameController_can_heal(bc_GameController* this, uint16_t healer_id, uint16_t target_robot_id);
  1056. /// Whether the healer is ready to heal. Tests whether the healer's attack heat is sufficiently low.
  1057. uint8_t bc_GameController_is_heal_ready(bc_GameController* this, uint16_t healer_id);
  1058. /// Commands the healer to heal the target robot.
  1059. ///
  1060. /// * NoSuchUnit - either unit does not exist (inside the vision range).
  1061. /// * InappropriateUnitType - the unit is not a healer, or the target is not a robot.
  1062. /// * TeamNotAllowed - either robot is not on the current player's team.
  1063. /// * UnitNotOnMap - the healer is not on the map.
  1064. /// * OutOfRange - the target does not lie within "attack" range of the healer.
  1065. /// * Overheated - the healer is not ready to heal again.
  1066. void bc_GameController_heal(bc_GameController* this, uint16_t healer_id, uint16_t target_robot_id);
  1067. /// 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.
  1068. uint8_t bc_GameController_can_overcharge(bc_GameController* this, uint16_t healer_id, uint16_t target_robot_id);
  1069. /// Whether the healer is ready to overcharge. Tests whether the healer's ability heat is sufficiently low.
  1070. uint8_t bc_GameController_is_overcharge_ready(bc_GameController* this, uint16_t healer_id);
  1071. /// Overcharges the robot, resetting the robot's cooldowns. The robot must be on the same team as you.
  1072. ///
  1073. /// * NoSuchUnit - either unit does not exist (inside the vision range).
  1074. /// * TeamNotAllowed - either robot is not on the current player's team.
  1075. /// * UnitNotOnMap - the healer is not on the map.
  1076. /// * InappropriateUnitType - the unit is not a healer, or the target is not a robot.
  1077. /// * ResearchNotUnlocked - you do not have the needed research to use overcharge.
  1078. /// * OutOfRange - the target does not lie within ability range of the healer.
  1079. /// * Overheated - the healer is not ready to use overcharge again.
  1080. void bc_GameController_overcharge(bc_GameController* this, uint16_t healer_id, uint16_t target_robot_id);
  1081. /// 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.
  1082. uint8_t bc_GameController_can_load(bc_GameController* this, uint16_t structure_id, uint16_t robot_id);
  1083. /// Loads the robot into the garrison of the structure.
  1084. ///
  1085. /// * NoSuchUnit - either unit does not exist (inside the vision range).
  1086. /// * TeamNotAllowed - either unit is not on the current player's team.
  1087. /// * UnitNotOnMap - either unit is not on the map.
  1088. /// * Overheated - the robot is not ready to move again.
  1089. /// * InappropriateUnitType - the first unit is not a structure, or the second unit is not a robot.
  1090. /// * StructureNotYetBuilt - the structure has not yet been completed.
  1091. /// * GarrisonFull - the structure's garrison is already full.
  1092. /// * OutOfRange - the robot is not adjacent to the structure.
  1093. void bc_GameController_load(bc_GameController* this, uint16_t structure_id, uint16_t robot_id);
  1094. /// 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.
  1095. uint8_t bc_GameController_can_unload(bc_GameController* this, uint16_t structure_id, bc_Direction direction);
  1096. /// Unloads a robot from the garrison of the specified structure into an adjacent space. Robots are unloaded in the order they were loaded.
  1097. ///
  1098. /// * NoSuchUnit - the unit does not exist (inside the vision range).
  1099. /// * TeamNotAllowed - either unit is not on the current player's team.
  1100. /// * UnitNotOnMap - the structure is not on the map.
  1101. /// * InappropriateUnitType - the unit is not a structure.
  1102. /// * StructureNotYetBuilt - the structure has not yet been completed.
  1103. /// * GarrisonEmpty - the structure's garrison is already empty.
  1104. /// * LocationOffMap - the location in the target direction is off the map.
  1105. /// * LocationNotEmpty - the location in the target direction is already occupied.
  1106. /// * Overheated - the robot inside the structure is not ready to move again.
  1107. void bc_GameController_unload(bc_GameController* this, uint16_t structure_id, bc_Direction direction);
  1108. /// 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.
  1109. uint8_t bc_GameController_can_produce_robot(bc_GameController* this, uint16_t factory_id, bc_UnitType robot_type);
  1110. /// Starts producing the robot of the given type.
  1111. ///
  1112. /// * NoSuchUnit - the factory does not exist (inside the vision range).
  1113. /// * TeamNotAllowed - the factory is not on the current player's team.
  1114. /// * InappropriateUnitType - the unit is not a factory, or the unit type is not a robot.
  1115. /// * StructureNotYetBuilt - the factory has not yet been completed.
  1116. /// * FactoryBusy - the factory is already producing a unit.
  1117. /// * InsufficientKarbonite - your team does not have enough Karbonite to produce the given robot.
  1118. void bc_GameController_produce_robot(bc_GameController* this, uint16_t factory_id, bc_UnitType robot_type);
  1119. /// The landing rounds and locations of rockets in space that belong to the current team.
  1120. bc_RocketLandingInfo* bc_GameController_rocket_landings(bc_GameController* this);
  1121. /// 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.
  1122. uint8_t bc_GameController_can_launch_rocket(bc_GameController* this, uint16_t rocket_id, bc_MapLocation* destination);
  1123. /// Launches the rocket into space, damaging the units adjacent to the takeoff location.
  1124. ///
  1125. /// * NoSuchUnit - the rocket does not exist (inside the vision range).
  1126. /// * TeamNotAllowed - the rocket is not on the current player's team.
  1127. /// * SamePlanet - the rocket cannot fly to a location on the same planet.
  1128. /// * InappropriateUnitType - the unit is not a rocket.
  1129. /// * StructureNotYetBuilt - the rocket has not yet been completed.
  1130. /// * RocketUsed - the rocket has already been used.
  1131. /// * LocationOffMap - the given location is off the map.
  1132. /// * LocationNotEmpty - the given location contains impassable terrain.
  1133. void bc_GameController_launch_rocket(bc_GameController* this, uint16_t rocket_id, bc_MapLocation* location);
  1134. ///
  1135. bc_GameController* bc_GameController_new_manager(bc_GameMap* map);
  1136. ///
  1137. bc_StartGameMessage* bc_GameController_start_game(bc_GameController* this, bc_Player* player);
  1138. ///
  1139. bc_TurnApplication* bc_GameController_apply_turn(bc_GameController* this, bc_TurnMessage* turn);
  1140. ///
  1141. bc_InitialTurnApplication* bc_GameController_initial_start_turn_message(bc_GameController* this);
  1142. ///
  1143. uint8_t bc_GameController_is_over(bc_GameController* this);
  1144. ///
  1145. bc_Team bc_GameController_winning_team(bc_GameController* this);
  1146. #ifdef __cplusplus
  1147. }
  1148. #endif
  1149. #endif // bc_h_
Add Comment
Please, Sign In to add comment