41 lines
1.0 KiB
Java
41 lines
1.0 KiB
Java
|
|
import java.util.Scanner;
|
|
|
|
public class ManualBot extends Bot {
|
|
public ManualBot(String [] args) {
|
|
super(args);
|
|
}
|
|
|
|
@Override
|
|
public char nextMove(View view) {
|
|
Scanner scanner = new Scanner(System.in);
|
|
System.out.print("Geben Sie einen Steuerbefehl ein (w/s/a/d/q): ");
|
|
String input = scanner.nextLine().trim().toLowerCase();
|
|
|
|
switch (input) {
|
|
case "w":
|
|
return '^';
|
|
case "s":
|
|
return 'v';
|
|
case "a":
|
|
return '<';
|
|
case "d":
|
|
return '>';
|
|
case "q":
|
|
System.out.println("Verbindung abgebrochen.");
|
|
System.exit(0);
|
|
return 0;
|
|
|
|
default:
|
|
System.out.println("Ungültiger Befehl. Bitte versuchen Sie es erneut.");
|
|
return nextMove(view);
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
ManualBot bot = new ManualBot(args);
|
|
bot.run();
|
|
}
|
|
|
|
}
|