6 import java.util.Scanner;
14 scanner =
new Scanner(System.in);
20 System.out.println(
"***Creation***\nSkill points: "+skill_points);
23 System.out.print(
"Attack? ");
24 to_return.attack = Integer.parseInt(scanner.nextLine());
25 System.out.print(
"Defense? ");
26 to_return.defense = Integer.parseInt(scanner.nextLine());
27 System.out.print(
"Power? ");
28 to_return.power = Integer.parseInt(scanner.nextLine());
29 System.out.print(
"Charge? ");
30 to_return.charge = Integer.parseInt(scanner.nextLine());
32 catch(NumberFormatException e)
34 System.out.println(e.getMessage());
47 for(
int j=0; j<neighborhood[0].length; j++)
49 for(
int i=0; i<neighborhood.length; i++)
50 switch(neighborhood[i][j].contents)
52 case EMPTY: System.out.print(
"-");
54 case BLOCKED: System.out.print(
"X");
56 case SELF: System.out.print(
"@");
57 to_return = neighborhood[i][j];
59 case ALLY: System.out.print(
"A");
61 case ENEMY: System.out.print(
"E");
63 case WALL: System.out.print(
"#");
66 switch(neighborhood[i][j].fort_orientation)
68 case UP: System.out.print(
"^");
70 case DOWN: System.out.print(
"V");
72 case LEFT: System.out.print(
"<");
74 case RIGHT: System.out.print(
">");
78 case CAPSULE: System.out.print(
"C");
85 System.out.println(
"Position: ["+to_return.x_coord+
"]["+to_return.y_coord+
"]");
91 GridCell[][] neighborhood = api.getVisibleNeighborhood();
93 System.out.print(
"ManualBot at ("+self.x_coord+
","+self.y_coord+
"):\n? ");
94 String command = scanner.next();
95 while(!command.equalsIgnoreCase(
"done"))
99 if(command.equalsIgnoreCase(
"move"))
101 System.out.print(
"Direction? ");
102 String dir = scanner.next();
103 System.out.print(
"Steps? ");
104 int steps = scanner.nextInt();
107 if(dir.equalsIgnoreCase(
"Up"))
109 else if(dir.equalsIgnoreCase(
"Down"))
111 else if(dir.equalsIgnoreCase(
"Left"))
118 else if(command.equalsIgnoreCase(
"attack"))
120 System.out.print(
"Type? ");
121 String typ = scanner.next();
123 System.out.print(
"Location x y? ");
124 int x_coord = scanner.nextInt();
125 int y_coord = scanner.nextInt();
127 System.out.print(
"Power? ");
128 int power = scanner.nextInt();
131 if(typ.equalsIgnoreCase(
"melee"))
132 result = api.
meleeAttack(power,neighborhood[x_coord - neighborhood[0][0].
x_coord][y_coord - neighborhood[0][0].
y_coord]);
133 else if(typ.equalsIgnoreCase(
"ranged"))
137 System.out.println(result.toString());
139 else if(command.equalsIgnoreCase(
"scan"))
143 System.out.print(
"Location x y? ");
144 int x_coord = scanner.nextInt();
145 int y_coord = scanner.nextInt();
146 api.scanEnemy(returnedSpecs,returnedStatus,neighborhood[x_coord - neighborhood[0][0].x_coord][y_coord - neighborhood[0][0].y_coord]);
148 System.out.println(
"Specs/Attack: "+returnedSpecs.attack);
149 System.out.println(
"Specs/Defense: "+returnedSpecs.defense);
150 System.out.println(
"Specs/Power: "+returnedSpecs.power);
151 System.out.println(
"Specs/Charge: "+returnedSpecs.charge);
152 System.out.println(
"Status/Power: "+returnedStatus.power);
153 System.out.println(
"Status/Charge: "+returnedStatus.charge);
154 System.out.println(
"Status/Health: "+returnedStatus.health);
155 System.out.println(
"Status/DefenseBoost: "+returnedStatus.defense_boost);
158 catch(
RoboSim.RoboSimExecutionException e)
160 System.out.println(e.getMessage());
167 System.out.print(
"? ");
168 command = scanner.next();
Robot_Specs createRobot(WorldAPI api, int skill_points, byte[] message)
void move(int steps, Robot.Direction way)
GridCell dumpGrid(GridCell[][] neighborhood)
void act(WorldAPI api, Robot_Status status, byte[][] received_radio)
Robot.AttackResult meleeAttack(int power, Robot.GridCell adjacent_cell)
Robot.AttackResult rangedAttack(int power, Robot.GridCell nonadjacent_cell)
Robot.GridCell[][] getVisibleNeighborhood()