SnakeBot/ManualBot.java

40 lines
1.0 KiB
Java
Raw Normal View History

2025-02-09 16:55:30 +01:00
import java.util.Scanner;
public class ManualBot extends Bot {
public ManualBot(String [] args) {
super(args);
}
@Override
2025-02-09 17:02:07 +01:00
public char nextMove(Bot.View view) {
2025-02-09 16:55:30 +01:00
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();
}
}