1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package Praktikum05;
-
- import java.util.Scanner;
-
- public class ManualBot extends Bot {
-
-
- protected ManualBot(String[] args) {
- super(args);
- }
-
- private Scanner input = new Scanner(System.in);
-
- @Override
- protected char nextMove(View view) throws Exception{
- boolean exit = false;
- while(!exit){
- System.out.println("Enter command: ");
- String command = input.nextLine();
- if(command != null){
- switch(command){
- case "w":
- return '^';
- case "a":
- return '<';
- case "s":
- return 'v';
- case "d":
- return '>';
- case "q":
- command = null;
- break;
- default:
- System.out.println("Kommando nicht verfügbar bitte einen anderes Kommando eingeben");
- break;
- }
- }
- }
- input.close();
- throw new Exception("Beendet");
- }
-
- public static void main(String args[]){
- Bot bot = new ManualBot(args);
- bot.run();
- }
- }
|