Browse Source

add nextMove method

testing_N
Alina Ehrensberger 1 year ago
parent
commit
d61cff8eeb
1 changed files with 22 additions and 4 deletions
  1. 22
    4
      src/ManualBot.java

+ 22
- 4
src/ManualBot.java View File

import java.util.Scanner;
public class ManualBot extends Bot{ public class ManualBot extends Bot{
public static void main(String[] args) { public static void main(String[] args) {
Bot manualBot = new ManualBot(args); Bot manualBot = new ManualBot(args);
} }


protected char nextMove(View view) throws Exception{ protected char nextMove(View view) throws Exception{
Scanner scanner = new Scanner();
scanner.
Scanner scanner = new Scanner(System.in);
switch(scanner.nextLine()){
case "w":
return '^' ;
break;
case "s":
return 'V' ;
break;
case "a":
return '<' ;
break;
case "d":
return '>' ;
break;
case "q":
throw new Exception;
break;
default:
break;
}



return c;
} }
} }

Loading…
Cancel
Save