12 to_return.attack = to_return.defense = to_return.power = to_return.charge = skill_points/4;
25 to_return.defense = 1;
31 skill_points-=(skill_points/4)*4;
32 to_return.attack += skill_points;
43 c1.y_coord == c2.y_coord ||
44 Math.abs(c1.y_coord-c2.y_coord)==1 &&
50 for(
int i=0; i<neighbors.length; i++)
51 for(
int j=0; j<neighbors[0].length; j++)
54 GridCell[] path = RobotUtility.findShortestPath(
self,neighbors[i][j],neighbors);
56 for(
int k=0; k<path.length-1 && remaining_power > 0; k++)
59 if(path[k].x_coord <
self.x_coord)
61 else if(path[k].x_coord >
self.x_coord)
63 else if(path[k].y_coord <
self.y_coord)
72 if(remaining_power > 0 &&
isAdjacent(
self,neighbors[i][j]))
74 api.meleeAttack(remaining_power,neighbors[i][j]);
79 return remaining_power;
84 int remaining_power = status.power;
85 int remaining_charge = status.charge;
89 GridCell[][] neighbors = api.getVisibleNeighborhood();
93 for(
int i=0; i<neighbors.length; i++)
94 for(
int j=0; j<neighbors[0].length; j++)
106 if(remaining_power > 3)
108 GridCell[][] world = api.getWorld(3);
113 catch(
RoboSim.RoboSimExecutionException e)
115 System.err.println(e.getMessage());
Robot_Specs createRobot(WorldAPI api, int skill_points, byte[] message)
static boolean isAdjacent(GridCell c1, GridCell c2)
void act(WorldAPI api, Robot_Status status, byte[][] received_radio)
static int searchAndDestroy(GridCell self, GridCell[][] neighbors, WorldAPI api, int remaining_power)