SHARE
TWEET

Untitled

a guest Dec 30th, 2016 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function RaidPlayer(playerController) {
  2.   this.pc = playerController;
  3. }
  4. RaidPlayer.prototype = {
  5.   act: function() {
  6.    
  7.     console.log('Round', this.pc.getGameRound());
  8.     var idx = 0;
  9.     var direction = this.pc.senseDirectionToExit();
  10.    
  11.     if(this.pc.canMove(direction))
  12.     {
  13.      
  14.       console.log('trying to move', direction.toString());
  15.       this.pc.move(direction);
  16.      
  17.     }
  18.     else
  19.     {
  20.        console.log('cannot move');
  21.        
  22.          if(this.pc.canMove(direction.rotateLeft()))
  23.           {
  24.            console.log('rotating left!');
  25.            direction = direction.rotateLeft();
  26.            this.pc.move(direction);
  27.            console.log('rotated left!');
  28.           }
  29.           else if(this.pc.canMove(direction.rotateRight()))
  30.           {
  31.             direction = direction.Right();
  32.             this.pc.move(direction);
  33.             console.log('rotated right!');
  34.            
  35.           }
  36.           else
  37.           this.pc.move(direction.randomDirection());
  38.           }
  39.   }
  40.   };
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