Example #1
0
  public void moveToQuadrant(int v, int h) {
    String coordinates = af.getQuadrantXY(v, h);
    int y = Integer.parseInt(coordinates.substring(0, coordinates.indexOf("_")));
    int x = Integer.parseInt(coordinates.substring(coordinates.indexOf("_") + 1));

    if (getX() < x) {
      while (getX() != x) {
        turn(Direction.RIGHT);
        move();
      }
    } else {
      while (getX() != x) {
        turn(Direction.LEFT);
        move();
      }
    }

    if (getY() < y) {
      while (getY() != y) {
        turn(Direction.DOWN);
        move();
      }
    } else {
      while (getY() != y) {
        turn(Direction.UP);
        move();
      }
    }
  }