public static void go_towards_destination() throws GameActionException {
    if (!rc.isCoreReady()) return;

    if (destination == null || destination.equals(current_location)) {
      dig(destination);
      return;
    }

    combat_mode = false;

    if (life_insurance_policy == Safety.KITE) combat_mode = true;

    // TODO alter try directions so we use non-diagonal if possible.
    Direction direction_to_head = current_location.directionTo(destination);
    for (int offset : (combat_mode ? combat_directions : try_directions)) {
      Direction try_to_walk = Direction.values()[(direction_to_head.ordinal() + offset + 8) % 8];
      if (rc.canMove(try_to_walk)) {
        if (life_insurance_policy.says_this_move_will_shorten_your_life(
            current_location.add(try_to_walk))) continue;
        previous_location = current_location;
        if (rc.canMove(try_to_walk)) {
          rc.move(try_to_walk);
        } else {
          System.out.println("Running over byte limit");
        }
        return;
      }
    }
    dig(destination);
  }
  public void run() {
    // Test floor lock-out with RandomEventGen
    //		for (int fl = 2; fl < 12; fl++) {
    //			controller.lockFloor(0, fl);
    //			controller.lockFloor(1, fl+10);
    //		}

    Random random = new Random();
    isRunning = true;
    while (true) {

      // check to see if user wants to stop this thread
      Thread.yield(); // let another thread have some time perhaps to stop this one.
      if (Thread.currentThread().isInterrupted()) {
        break;
      }

      /* Generate a random float between 0.0 - 1.0
       * every 0.5 seconds
       */
      try {
        sleep(500);
      } catch (InterruptedException e) {
        break;
      }

      if (!paused) {

        float randomFloat = random.nextFloat();

        /* Create the event if randomFloat is less
         * than the specified probability.
         */
        if (probPassenger > randomFloat) {
          int arrivalFl = 0;
          int destFl = 0;

          // Loop until we get a valid floor request
          do {
            arrivalFl = random.nextInt(controller.getMaxFloor() + 1);
            destFl = random.nextInt(controller.getMaxFloor() + 1);
          } while (!controller.validFloorReq(arrivalFl, destFl));

          // Create Passenger
          try {
            Passenger passenger =
                new Passenger(
                    arrivalFl,
                    destFl,
                    40 + random.nextInt(70),
                    // if building has penthouse and dest is penthouse -> VIP = true
                    (destFl == controller.getMaxFloor() && controller.hasPenthouse())
                        ? true
                        : false);

            // Pass passenger to the Controller
            controller.newPassengerRequest(passenger);
          } catch (BossLiftGeneralException e) { // do nothing

          }
        }

        // Passenger will request emergency
        // if randomFloat is less than probEmergency.
        if (probEmergency > randomFloat) {
          // Only send passenger emergency request to elevators with passengers
          // First check to see if there are passengers in a random elevator
          int elevID = random.nextInt(controller.getElevNum());

          // Avoid potential infinite loop if there are no passengers in the system.
          for (int i = 0; i < 10; i++) {

            if (controller.passengerInElev(elevID)) {
              try {
                safety.passengerEmergencyRequest(elevID);
              } catch (BossLiftGeneralException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              break;
            }
            // if not - check next elevator that has passenger -> send emergency to safety
            elevID = (elevID += 1) % controller.getElevNum();
          }
        }

        // Make maintenance event probability exclusive
        // from passenger emergency probability
        if (probFault > (1.0f - randomFloat)) {
          // Create random integer for specific floor and pass it to safety
          // safety.randomMaintenanceRequest(random.nextInt());
          safety.injectFloorFault(random.nextInt(controller.getMaxFloor() + 1));
        }
      } else {
        try {
          Thread.sleep(500);
        } catch (InterruptedException e) {
          break;
        }
      }
    }

    isRunning = false;
  }