38 lines
705 B
Java
38 lines
705 B
Java
|
public class EscapeBot extends Bot{
|
||
|
boolean rocketDetected = false;
|
||
|
public static void main(String[] args) {
|
||
|
|
||
|
Bot escapeBot = new EscapeBot(args);
|
||
|
escapeBot.run();
|
||
|
}
|
||
|
protected EscapeBot(String[] args) {
|
||
|
super(args);
|
||
|
}
|
||
|
|
||
|
protected char nextMove(View view) throws Exception {
|
||
|
char[] viewField = view.data.toCharArray();
|
||
|
|
||
|
|
||
|
for (int i = 0; i < viewField.length; i++) {
|
||
|
if(viewField[i] == 'o'){
|
||
|
rocketDetected = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(rocketDetected){
|
||
|
|
||
|
}else{
|
||
|
return randomWalk();
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
private char randomWalk() {
|
||
|
return '^';
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|