SHARE
TWEET

Untitled

a guest Jan 24th, 2020 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     public void face(Direction dir) {
  3.         for (int i = 0; i < 3; i++) {
  4.             if(facingWest() && dir == Directions.West) return;
  5.             if(facingNorth() && dir == Directions.North) return;
  6.             if(facingSouth() && dir == Directions.South) return;
  7.             if(facingEast() && dir == Directions.East) return;
  8.             turnLeft();
  9.         }
  10.     }
  11.    
  12.     public void move(int spaces, Direction dir) {
  13.         face(dir);
  14.         for (int i = 0; i < spaces; i++) {
  15.             move();
  16.         }
  17.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top