Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- /**
- * Made with love by AntiSquid, Illedan and Wildum.
- * You can help children learn to code while you participate by donating to CoderDojo.
- **/
- struct Entity{
- int unitId;
- int team;
- string unitType; // UNIT, HERO, TOWER, can also be GROOT from wood1
- int x;
- int y;
- int attackRange;
- int health;
- int maxHealth;
- int shield; // useful in bronze
- int attackDamage;
- int movementSpeed;
- int stunDuration; // useful in bronze
- int goldValue;
- int countDown1; // all countDown and mana variables are useful starting in bronze
- int countDown2;
- int countDown3;
- int mana;
- int maxMana;
- int manaRegeneration;
- string heroType; // DEADPOOL, VALKYRIE, DOCTOR_STRANGE, HULK, IRONMAN
- int isVisible; // 0 if it isn't
- int itemsOwned; // useful from wood1
- };
- struct Item{
- string itemName; // contains keywords such as BRONZE, SILVER and BLADE, BOOTS connected by "_" to help you sort easier
- int itemCost; // BRONZE items have lowest cost, the most expensive items are LEGENDARY
- int damage; // keyword BLADE is present if the most important item stat is damage
- int health;
- int maxHealth;
- int mana;
- int maxMana;
- int moveSpeed; // keyword BOOTS is present if the most important item stat is moveSpeed
- int manaRegeneration;
- int isPotion; // 0 if it's not instantly consumed
- };
- void wait() {
- cout << "WAIT" << endl;}
- void move(int x, int y){
- cout << "MOVE " << x << ' ' << y << endl;}
- void attack(int id){
- cout << "ATTACK " << id << endl;}
- void attack_nearest(string type){
- cout << "ATTACK_NEAREST " << type << endl;}
- void move_attack(int x, int y, string id){
- cout << "MOVE ATTACK " << x << ' ' << y << ' ' << id << endl;}
- void buyItem(string itemName){
- cout << "BUY " << itemName << endl;}
- void sellItem(string itemName){
- cout << "SELL " << itemName << endl;}
- int main()
- {
- int myTeam;
- cin >> myTeam; cin.ignore();
- int bushAndSpawnPointCount; // useful from wood1, represents the number of bushes and the number of places where neutral units can spawn
- cin >> bushAndSpawnPointCount; cin.ignore();
- for (int i = 0; i < bushAndSpawnPointCount; i++) {
- string entityType; // BUSH, from wood1 it can also be SPAWN
- int x;
- int y;
- int radius;
- cin >> entityType >> x >> y >> radius; cin.ignore();
- }
- int itemCount; // useful from wood2
- cin >> itemCount; cin.ignore();
- vector<Item> item;
- for (int i = 0; i < itemCount; i++) {
- cin >> item[i].itemName >> item[i].itemCost >> item[i].damage >> item[i].health >> item[i].maxHealth >> item[i].mana >> item[i].maxMana >> item[i].moveSpeed >> item[i].manaRegeneration >> item[i].isPotion; cin.ignore();
- }
- // game loop
- while (1) {
- int gold;
- cin >> gold; cin.ignore();
- int enemyGold;
- cin >> enemyGold; cin.ignore();
- int roundType; // a positive value will show the number of heroes that await a command
- cin >> roundType; cin.ignore();
- int entityCount;
- cin >> entityCount; cin.ignore();
- Entity entity[entityCount];
- for (int i = 0; i < entityCount; i++) {
- cin >> entity[i].unitId >> entity[i].team >> entity[i].unitType >> entity[i].x >> entity[i].y >> entity[i].attackRange >> entity[i].health >> entity[i].maxHealth >> entity[i].shield >> entity[i].attackDamage >> entity[i].movementSpeed >> entity[i].stunDuration >> entity[i].goldValue >> entity[i].countDown1 >> entity[i].countDown2 >> entity[i].countDown3 >> entity[i].mana >> entity[i].maxMana >> entity[i].manaRegeneration >> entity[i].heroType >> entity[i].isVisible >> entity[i].itemsOwned; cin.ignore();
- if(roundType < 0)
- wait();
- else
- attack_nearest("HERO");
- }
- }
- }
- /* NOTES
- TODO:
- Add remember current heroes-able-to-be-controlled id;
- DONE:
- Added simple functions for cout (makes life easier)
- Added structs
- // Write an action using cout. DON'T FORGET THE "<< endl"
- // To debug: cerr << "Debug messages..." << endl;
- // If roundType has a negative value then you need to output a Hero name, such as "DEADPOOL" or "VALKYRIE".
- // Else you need to output roundType number of any valid action, such as "WAIT" or "ATTACK unitId"
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement