Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <list>
- using namespace std;
- const int WIDTH = 12;
- const int HEIGHT = 12;
- char gameArea[WIDTH][HEIGHT];
- int i, j;
- int camp = -1;
- int numberMineSpots;
- int gold;
- int income;
- int opponentGold;
- int opponentIncome;
- int buildingCount;
- int unitCount;
- void build(string type, int x, int y)
- {
- cout << "BUILD " << type << " " << x << " " << y << ";";
- }
- void train(int lvl, int x, int y)
- {
- cout << "TRAIN " << lvl << " " << x << " " << y << ";";
- }
- void move(int id, int x, int y)
- {
- cout << "MOVE " << id << " " << x << " " << y << ";";
- }
- int checkCamp(int x) //0 == UPLEFT //1 == DOWNRIGHT
- {
- if(x == 0)
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
- void defaultCreateUnit()
- {
- if(camp == 0) //QG UPLEFT
- {
- train(1, 1, 0);
- train(1, 0, 1);
- }
- else //QG DOWNRIGHT
- {
- train(1, 10, 11);
- train(1, 11, 10);
- }
- }
- class Building
- {
- public:
- int owner;
- int buildingType;
- int x;
- int y;
- };
- class Units
- {
- public:
- int owner;
- int unitId;
- int level;
- int x;
- int y;
- };
- int main()
- {
- cin >> numberMineSpots; cin.ignore(); //MINE PAS UTILE POUR L'INSTANT
- for (i = 0; i < numberMineSpots; i++) {
- int x;
- int y;
- cin >> x >> y; cin.ignore();
- }
- // game loop
- while (1) {
- cin >> gold; cin.ignore();
- cin >> income; cin.ignore();
- cin >> opponentGold; cin.ignore();
- cin >> opponentIncome; cin.ignore();
- for (i = 0; i < HEIGHT; i++) {
- char line[WIDTH];
- cin >> line; cin.ignore();
- for (j = 0; j < WIDTH; j++)
- {
- gameArea[j][i] = line[j];
- }
- }
- cin >> buildingCount; cin.ignore();
- list<Building> buildList;
- for (i = 0; i < buildingCount; i++) {
- Building building;
- cin >> building.owner >> building.buildingType >> building.x >> building.y; cin.ignore();
- buildList.emplace_front(new Building{building.owner, building.buildingType, building.x, building.y});
- if(building.buildingType == 0 && building.owner == 0) //si mon QG check sa pos
- {
- camp = checkCamp(building.x);
- }
- }
- cin >> unitCount; cin.ignore();
- for (i = 0; i < unitCount; i++) {
- int owner;
- int unitId;
- int level;
- int x;
- int y;
- cin >> owner >> unitId >> level >> x >> y; cin.ignore();
- }
- defaultCreateUnit();
- cout << "WAIT" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement