56 lines
990 B
Java
56 lines
990 B
Java
|
|
import java.util.Scanner;
|
|
|
|
public class EscapeBot extends Bot {
|
|
|
|
int steps = 0;
|
|
int counter = 0;
|
|
public EscapeBot(String [] args) {
|
|
super(args);
|
|
}
|
|
public char found (View view) throws Exception{
|
|
|
|
boolean field = view.data.contains("o");
|
|
|
|
if(field){
|
|
counter++;
|
|
}
|
|
if(counter % 3 == 0){
|
|
return '<';
|
|
} else {
|
|
return '^';
|
|
}
|
|
}
|
|
@Override
|
|
public char nextMove(View view) throws Exception {
|
|
steps++;
|
|
if(view.data.contains("o")) {
|
|
return found(view);
|
|
}
|
|
switch(steps){
|
|
case 1:
|
|
return '<';
|
|
case 5:
|
|
return '>';
|
|
case 32:
|
|
steps = 0;
|
|
return '^';
|
|
default:
|
|
return '^';
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
EscapeBot bot = new EscapeBot(args);
|
|
bot.run();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|