Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public void input() {
  2. Scanner keyboard = new Scanner(System.in);
  3. System.out.print("Move (l/r/u/d): ");
  4. String name = keyboard.nextLine();
  5.  
  6. if(name.equals("l")) {
  7. move(-1,0);
  8. }
  9. else if(name.equals("r")) {
  10. move(1,0);
  11. }
  12. else if(name.equals("u")) {
  13. move(0,-1);
  14. }
  15. else if(name.equals("d")) {
  16. move(0,1);
  17. }
  18. else {
  19. System.out.println("Invalid move");
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement