54 lines
1.2 KiB
Java
54 lines
1.2 KiB
Java
import java.util.Scanner;
|
|
|
|
public class ManualBot extends Bot{
|
|
|
|
private Scanner scanner;
|
|
|
|
public static void main(String[] args){
|
|
ManualBot mb = new ManualBot(args);
|
|
mb.run();
|
|
|
|
}
|
|
|
|
public ManualBot(String[] args){
|
|
super(args);
|
|
scanner = new Scanner(System.in);
|
|
}
|
|
|
|
@Override
|
|
protected char nextMove(View view) throws Exception {
|
|
|
|
char c = '\0';
|
|
while (scanner.hasNextLine()) {
|
|
String input = scanner.nextLine().trim();
|
|
if (input.isEmpty()) {
|
|
break;
|
|
}
|
|
if (input.length() == 1) {
|
|
c = translate(input.charAt(0));
|
|
System.out.println(c);
|
|
break;
|
|
} else {
|
|
System.out.println("nur einen Schritt gehen");
|
|
}
|
|
}
|
|
return c;
|
|
}
|
|
|
|
private char translate(char x) throws Exception{
|
|
switch (x){
|
|
case 'w':
|
|
return '^';
|
|
case 'a':
|
|
return '<';
|
|
case 'd':
|
|
return '>';
|
|
case 's':
|
|
return 'v';
|
|
case 'q':
|
|
throw new Exception();
|
|
}
|
|
return x;
|
|
}
|
|
}
|