48 for (
auto& ant : new_ants)
64 { return x.id == a.id; });
67 if (!(it->x == a.x && it->y == a.y))
69 it->x = a.x, it->y = a.y, it->hp = a.hp, it->age = a.age, it->state = a.state;
An integrated module of IO and game state management with simple interfaces for your convenience....
Definition: control.hpp:24
GameInfo info
Current game information.
Definition: control.hpp:26
const GameInfo & get_info() const
Get information about current game state.
Definition: control.hpp:120
bool append_self_operation(OperationType type, int arg0=-1, int arg1=-1)
Try adding an operation to "self_operations". The operation will be constructed with the given type a...
Definition: control.hpp:199
void update_ant(const Ant &a)
Update "info.ants" with ant "a".
Definition: control.hpp:61
const std::vector< Operation > & get_self_operations() const
Get added operations.
Definition: control.hpp:129
void update_ants(const std::vector< Ant > &new_ants)
Update "info.ants" with vector "new_ants" and reset "info.next_ant_id".
Definition: control.hpp:46
void update_coins(int coin0, int coin1)
Update "info.coins".
Definition: control.hpp:83
void read_round_info()
Read round information from judger and update current game state.
Definition: control.hpp:146
void update_bases_hp(int hp0, int hp1)
Update health points (HP) of "info.base[0]" and "info.base[1]".
Definition: control.hpp:95
Controller(InitInfo init_info)
Construct a new Controller object with given init info.
Definition: control.hpp:104
void apply_opponent_operations()
Apply all the operations in "opponent_operations" to current game state.
Definition: control.hpp:182
std::vector< Operation > self_operations
Self operations which are about to be sent.
Definition: control.hpp:27
Controller()
Construct a new Controller object. Read initializing information from judger and initialize.
Definition: control.hpp:114
const int self_player_id
Your player ID.
Definition: control.hpp:108
void read_opponent_operations()
Read opponent's operations from judger and overwrites "opponent_operations".
Definition: control.hpp:174
void apply_self_operations()
Apply all the operations in "self_operations" to current game state.
Definition: control.hpp:223
const std::vector< Operation > & get_opponent_operations() const
Get saved opponent's operations.
Definition: control.hpp:138
void send_self_operations() const
Send all the operations in "self_operations" (i.e. print to stdout)
Definition: control.hpp:235
std::vector< Operation > opponent_operations
Opponent's operations received from judger.
Definition: control.hpp:28
void update_towers(std::vector< Tower > &new_towers)
Update "info.towers" with vector "new_towers" and reset "info.next_tower_id".
Definition: control.hpp:36
bool append_self_operation(Operation op)
Try adding an operation to "self_operations". The operation has been constructed elsewhere....
Definition: control.hpp:210
int get_direction(int x0, int y0, int x1, int y1)
Get the direction of two adjacent points, starting from the first and pointing to the second.
Definition: common.hpp:178
OperationType
Tag for the type of an operation. The integer values of these enumeration items are also their indexe...
Definition: common.hpp:723
A bottom module used for game state management.
A module for communicating with Judger.
void send_operations(const std::vector< Operation > &ops)
Send some serialized operations with header to judger.
Definition: io.hpp:220
InitInfo read_init_info()
Read information for initialization.
Definition: io.hpp:27
Basic attacking unit.
Definition: common.hpp:230
A module used for game state management, providing interfaces for accessing and modifying various typ...
Definition: game_info.hpp:28
int round
Current round number.
Definition: game_info.hpp:29
void count_down_super_weapons_cd()
Count down cd of all types of super weapons.
Definition: game_info.hpp:798
std::vector< Ant > ants
All ants on the map.
Definition: game_info.hpp:31
int next_ant_id
ID of the next generated ant.
Definition: game_info.hpp:38
void update_pheromone_for_ants()
Update pheromone for each ant.
Definition: game_info.hpp:280
void clear_dead_and_succeeded_ants()
Clear ants of state "Success", "Fail" or "TooOld".
Definition: game_info.hpp:266
void global_pheromone_attenuation()
Global pheromone attenuation.
Definition: game_info.hpp:333
bool is_operation_valid(int player_id, const Operation &op) const
Check operation validness.
Definition: game_info.hpp:369
int next_tower_id
ID of the next built tower.
Definition: game_info.hpp:39
std::vector< Tower > towers
All towers on the map.
Definition: game_info.hpp:30
void apply_operation(int player_id, const Operation &op)
Change buildings, targets and coin values based on the given operation.
Definition: game_info.hpp:545
void count_down_super_weapons_left_time(int player_id)
Count down left_time of super weapons for a player. Clear it if timeout.
Definition: game_info.hpp:776
void set_coin(int player_id, int value)
Set the number of coins for a player.
Definition: game_info.hpp:232
void set_base_hp(int player_id, int value)
Set the hp of base for a player.
Definition: game_info.hpp:248
Player's operations. It is able to be applied to the map.
Definition: common.hpp:742