Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void input() {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Move (l/r/u/d): ");
- String name = keyboard.nextLine();
- if(name.equals("l")) {
- move(-1,0);
- }
- else if(name.equals("r")) {
- move(1,0);
- }
- else if(name.equals("u")) {
- move(0,-1);
- }
- else if(name.equals("d")) {
- move(0,1);
- }
- else {
- System.out.println("Invalid move");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement