Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1.         int entityCount; // number of entities visible to you
  2.         int radarCooldown; // turns left until a new radar can be requested
  3.         int trapCooldown; // turns left until a new trap can be requested
  4.         cin >> entityCount >> radarCooldown >> trapCooldown; cin.ignore();
  5.         for (int i = 0; i < entityCount; i++) {
  6.             int id; // unique id of the entity
  7.             int type; // 0 for your robot, 1 for other robot, 2 for radar, 3 for trap
  8.             int x;
  9.             int y; // position of the entity
  10.             int item; // if this entity is a robot, the item it is carrying (-1 for NONE, 2 for RADAR, 3 for TRAP, 4 for ORE)
  11.             cin >> id >> type >> x >> y >> item; cin.ignore();
  12.            
  13.             if(type == 0) myRobots.push_back({id,x,y,item});
  14.             if(type == 1) enRobots.push_back({id,x,y,item});
  15.             if(type == 2) {
  16.                 radars.push_back({id,x,y,item});
  17.                 for(int j = 0; j < radarsPlaces.size(); j++)
  18.                 {
  19.                     if(x == radarsPlaces[j].x && y == radarsPlaces[j].y)
  20.                     {
  21.                         radarsPlaces[j].radar = true;
  22.                     }
  23.                 }
  24.             }
  25.             if(type == 3) traps.push_back({id,x,y,item});
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement