Пример #1
0
 private boolean useByreGots(boolean ignoreCondition) throws InterruptedException {
   if (ignoreCondition || isGoodOrExcellentCondition()) {
     Motors.getInstance().pressB();
     Thread.sleep(BUFF_TIME);
     return true;
   }
   return false;
 }
Пример #2
0
 @Override
 public void run() throws Exception {
   CraftBot.STATE = CraftBot.STATE_GETRUNCOUNT;
   int runCount = Util.getNumberSelection();
   Thread.sleep(1000);
   CraftBot.STATE = CraftBot.STATE_RUNNING;
   Motors.getInstance().initRemoteNXT();
   run3starProgram(runCount);
 }
Пример #3
0
 private void handleGood() throws InterruptedException {
   if (isGoodCondition()) {
     Motors.getInstance().pressB();
     Thread.sleep(BUFF_TIME);
     if (stage < 3 && !goodseen2) {
       goodseen2 = true;
       goodcounter++;
     }
     goodcounter++;
   }
 }
Пример #4
0
  private void run3starProgram(int runLength) throws InterruptedException, IOException {
    Stopwatch foodTimer = new Stopwatch();
    foodTimer.reset();
    // press10();//eat food
    for (int i = 0; i < runLength; i++) {
      goodcounter = 0;
      goodseen2 = false;
      if (foodTimer.elapsed() >= 1620000) { // 27 minutes
        foodTimer.reset();
        // press10();//eat food
      }
      LCD.clear();
      LCD.drawString("Battery: " + Battery.getVoltage(), 0, 0);
      LCD.drawString("BatteryR: " + Motors.getInstance().getRemoteBattery(), 0, 1);
      LCD.drawString("REMAIN: " + (runLength - i - 1), 0, 2);

      // start craft from craft menu
      Motors.getInstance().pressC();
      Thread.sleep(1000);
      Motors.getInstance().pressC();
      Thread.sleep(2000);

      // stage 1
      stage = 1;
      Motors.getInstance().pressA(); // comfort zone
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteC(); // inner quiet
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteB(); // CarefulSynth2
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteB(); // CarefulSynth2
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 2
      stage = 2;
      Motors.getInstance().pressA(); // steady hand 2
      Thread.sleep(BUFF_TIME);
      goodseen = false;
      for (int j = 0; j < 4; j++) {
        handleGood2();
        if (goodcounter > 0) {
          goodcounter--;
          Motors.getInstance().pressRemoteC(); // basic touch
        } else {
          Motors.getInstance().pressRemoteB(); // hasty touch
        }
        Thread.sleep(TOUCH_TIME);
      }
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 3
      stage = 3;
      handleGood();
      Motors.getInstance().pressA(); // comfort zone
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteC(); // master's mend 2
      Thread.sleep(BUFF_TIME);
      handleGood();
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 4
      stage = 4;
      Motors.getInstance().pressA(); // steady hand 2
      Thread.sleep(BUFF_TIME);
      goodseen = false;
      for (int j = 0; j < 4; j++) {
        handleGood2();
        if (goodcounter > 0) {
          goodcounter--;
          Motors.getInstance().pressRemoteC(); // basic touch
        } else {
          Motors.getInstance().pressRemoteB(); // hasty touch
        }
        Thread.sleep(TOUCH_TIME);
      }
      Motors.getInstance().pressA(); // steady hand 2
      Thread.sleep(BUFF_TIME);
      Motors.getInstance().pressRemoteA(); // go to next stage
      Thread.sleep(250);

      // stage 5
      stage = 4;
      boolean byresUsed = false;
      Motors.getInstance().pressA(); // Great Strides
      Thread.sleep(BUFF_TIME);
      Motors.getInstance().pressRemoteB(); // Innovation
      Thread.sleep(BUFF_TIME);
      if (!byresUsed) byresUsed = useByreGots(false);
      Motors.getInstance().pressRemoteC(); // Ingenuity 2
      Thread.sleep(BUFF_TIME);
      if (!byresUsed) byresUsed = useByreGots(true);
      Motors.getInstance().pressRemoteA(); // Finish
      Thread.sleep(TOUCH_TIME * 3 + 4000);
    }
    Motors.getInstance().shutdown();
  }