40 skill_points-=(skill_points/4)*4;
41 to_return.
attack += skill_points;
61 for(
int i=0; i<neighbors.size(); i++)
62 for(
int j=0; j<neighbors[0].size(); j++)
63 if(neighbors[i][j].contents==
ENEMY)
68 auto end_pos = path.end();
70 for(
auto k=path.begin(); k!=end_pos && remaining_power > 0; k++)
74 if((*k)->x_coord <
self.x_coord)
76 else if((*k)->x_coord >
self.x_coord)
78 else if((*k)->y_coord <
self.y_coord)
87 if(remaining_power > 0 && isAdjacent(
self,neighbors[i][j]))
94 return remaining_power;
99 int remaining_power = status.
power;
100 int remaining_charge = status.
charge;
108 for(
int i=0; i<neighbors.size(); i++)
109 for(
int j=0; j<neighbors[0].size(); j++)
110 if(neighbors[i][j].contents==
SELF)
112 self=neighbors[i][j];
117 remaining_power = searchAndDestroy(
self,neighbors,api,remaining_power);
121 if(remaining_power > 3)
125 searchAndDestroy(
self,world,api,remaining_power);
130 cerr << e.
msg << endl;
virtual AttackResult meleeAttack(int power, GridCell &adjacent_cell)=0
virtual vector< vector< GridCell > > getVisibleNeighborhood()=0
static bool isAdjacent(const GridCell &c1, const GridCell &c2)
Robot_Specs createRobot(WorldAPI *api, int skill_points, vector< uint8_t > message)
virtual vector< vector< GridCell > > getWorld(int power)=0
static int searchAndDestroy(GridCell &self, vector< vector< GridCell >> neighbors, WorldAPI &api, int remaining_power)
virtual void move(int steps, Direction way)=0
static std::list< GridCell * > findShortestPath(GridCell &origin, const GridCell &target, std::vector< std::vector< GridCell > > &grid)
void act(WorldAPI &api, Robot_Status status, vector< vector< uint8_t >> received_radio)