ANTWAR C++ SDK
|
Models and constants. More...
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include "optional.hpp"
Go to the source code of this file.
Classes | |
struct | Ant |
Basic attacking unit. More... | |
struct | TowerInfo |
Structure of static information of a type of towers. More... | |
struct | Tower |
Defense unit. Only choice to get yourself armed to the teeth. More... | |
struct | Base |
Target to protect or to destroy. More... | |
struct | SuperWeapon |
Great choice to knockout your opponent. More... | |
struct | Operation |
Player's operations. It is able to be applied to the map. More... | |
struct | Random |
Random noise generator. More... | |
Enumerations | |
enum class | BuildingType { Empty , Tower , Base } |
A tag indicating the type of a building on the map. | |
enum | PointType { Void = -1 , Path = 0 , Barrier = 1 , Player0Highland = 2 , Player1Highland = 3 } |
Tag indicating property of points. More... | |
enum | AntState { Alive = 0 , Success = 1 , Fail = 2 , TooOld = 3 , Frozen = 4 } |
State of an ant, indicating its life cycle stages. More... | |
enum | TowerType { Basic = 0 , Heavy = 1 , HeavyPlus = 11 , Ice = 12 , Cannon = 13 , Quick = 2 , QuickPlus = 21 , Double = 22 , Sniper = 23 , Mortar = 3 , MortarPlus = 31 , Pulse = 32 , Missile = 33 } |
Tag for the type of a tower. The integer values of these enumeration items are also their indexes. | |
enum | SuperWeaponType { LightningStorm = 1 , EmpBlaster = 2 , Deflector = 3 , EmergencyEvasion = 4 , SuperWeaponCount } |
Tag for the type of a super weapon. The integer values of these enumeration items are also their indexes. | |
enum | OperationType { BuildTower = 11 , UpgradeTower = 12 , DowngradeTower = 13 , UseLightningStorm = 21 , UseEmpBlaster = 22 , UseDeflector = 23 , UseEmergencyEvasion = 24 , UpgradeGenerationSpeed = 31 , UpgradeGeneratedAnt = 32 } |
Tag for the type of an operation. The integer values of these enumeration items are also their indexes. More... | |
Functions | |
int | distance (int x0, int y0, int x1, int y1) |
Get the distance between two points on the map (NOT Euclidean distance). | |
bool | is_valid_pos (int x, int y) |
Check if the given coordinates refers to a valid point on the map. | |
bool | is_path (int x, int y) |
Check if the given position is reachable for ants. | |
bool | is_highland (int player, int x, int y) |
Check if a player can build towers at given position. | |
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. | |
Variables | |
static constexpr int | MAX_ROUND = 512 |
Max number of rounds. | |
static constexpr int | EDGE = 10 |
Length of one edge. | |
static constexpr int | MAP_SIZE = 2 * EDGE - 1 |
Size of the map. | |
static constexpr int | MAP_PROPERTY [MAP_SIZE][MAP_SIZE] |
Point types of the map. | |
static constexpr int | OFFSET [2][6][2] |
The offsets between the coordinates of the current point and its surrounding 6 points. | |
static constexpr int | COIN_INIT = 50 |
static constexpr int | BASIC_INCOME = 1 |
static constexpr int | TOWER_BUILD_PRICE_BASE = 15 |
static constexpr int | TOWER_BUILD_PRICE_RATIO = 2 |
static constexpr int | LEVEL2_TOWER_UPGRADE_PRICE = 60 |
static constexpr int | LEVEL3_TOWER_UPGRADE_PRICE = 200 |
static constexpr double | TOWER_DOWNGRADE_REFUND_RATIO = 0.8 |
static constexpr int | LEVEL2_BASE_UPGRADE_PRICE = 200 |
static constexpr int | LEVEL3_BASE_UPGRADE_PRICE = 250 |
static constexpr double | PHEROMONE_INIT = 10 |
static constexpr double | PHEROMONE_MIN = 0 |
static constexpr double | PHEROMONE_ATTENUATING_RATIO = 0.97 |
constexpr TowerInfo | TOWER_INFO [] |
Static information of all types of tower. | |
static constexpr int | SUPER_WEAPON_INFO [5][4] |
Static information of all types of super weapons. | |
Models and constants.
enum AntState |
State of an ant, indicating its life cycle stages.
Enumerator | |
---|---|
Alive | Normal case. |
Success | Reach the opponent's camp. |
Fail | Non-positive health points (HP) |
TooOld | Reach age limit. |
Frozen | Frozen, cannot move. |
enum OperationType |
Tag for the type of an operation. The integer values of these enumeration items are also their indexes.
enum PointType |
|
inline |
Get the distance between two points on the map (NOT Euclidean distance).
x0 | The x-coordinate of the first point. |
y0 | The y-coordinate of the first point. |
x1 | The x-coordinate of the second point. |
y1 | The y-coordinate of the second point. |
|
inline |
Get the direction of two adjacent points, starting from the first and pointing to the second.
x0 | The x-coordinate of the first point. |
y0 | The y-coordinate of the first point. |
x1 | The x-coordinate of the second point. |
y1 | The y-coordinate of the second point. |
|
inline |
Check if a player can build towers at given position.
x | The x-coordinate of the point. |
y | The y-coordinate of the point. |
|
inline |
Check if the given position is reachable for ants.
x | The x-coordinate of the point. |
y | The y-coordinate of the point. |
|
inline |
Check if the given coordinates refers to a valid point on the map.
x | The x-coordinate of the point. |
y | The y-coordinate of the point. |
|
staticconstexpr |
Length of one edge.
Point types of the map.
|
staticconstexpr |
Size of the map.
|
staticconstexpr |
The offsets between the coordinates of the current point and its surrounding 6 points.
When y is even: {x - 1, y} {x, y - 1} {x, y + 1} {x, y} {x + 1, y - 1} {x + 1, y + 1} {x + 1, y} When y is odd: {x - 1, y} {x - 1, y - 1} {x - 1, y + 1} {x, y} {x, y - 1} {x, y + 1} {x + 1, y}
|
staticconstexpr |
Static information of all types of super weapons.
|
constexpr |
Static information of all types of tower.