CircleEx1() { NxtRobot robot = new NxtRobot(); Gear gear = new Gear(); robot.addPart(gear); gear.setSpeed(60); /*The robot move in a circle with the radius 0.2 for 7500 ms. *Instead of using a locking-method, the method leftArc(0.2) can be used together with the command Tools.delay(7500) */ gear.leftArc(0.2, 7500); /* No blocking Methode rightArc()*/ gear.rightArc(0.2); Tools.delay(5000); robot.exit(); }
public EnchantComparison(Setup setup, Gear gear, int slot) { this.setup = setup; this.gear = gear.clone(); this.slot = slot; this.gear.setEnchant(slot, null); comparedEnchants = new ArrayList<Enchant>(); runComparison(); }
private void runComparison() { Calculations m = Calculations.createInstance(); m.calculate(setup, gear); defaultDPS = m.getTotalDPS(); Collection<Enchant> enchants; SlotType slotType = SlotType.Trinket; switch (slot) { case 0: slotType = SlotType.Head; break; case 2: slotType = SlotType.Shoulder; break; case 3: slotType = SlotType.Back; break; case 4: slotType = SlotType.Chest; break; case 7: slotType = SlotType.Wrist; break; case 8: slotType = SlotType.Hands; break; case 10: slotType = SlotType.Legs; break; case 11: slotType = SlotType.Feet; break; case 12: case 13: slotType = SlotType.Finger; break; case 16: case 17: slotType = SlotType.OneHand; break; } enchants = Enchant.findSlot(slotType); for (Enchant e : enchants) { gear.setEnchant(slot, e); m.calculate(setup, gear); e.setComparedDPS(m.getTotalDPS() - defaultDPS); comparedEnchants.add(e); } Collections.sort(comparedEnchants); }
public parcourse() { NxtRobot robot = new NxtRobot(); Gear gear = new Gear(); TouchSensor ts1 = new TouchSensor(SensorPort.S3); TouchSensor ts2 = new TouchSensor(SensorPort.S4); robot.addPart(ts1); robot.addPart(ts2); gear.setSpeed(60); robot.addPart(gear); gear.forward(); while (true) { if ((ts1.isPressed()) && (count1 % 2 != 0)) { gear.backward(900); gear.left(375); gear.backward(); count1++; } if ((ts1.isPressed()) && (count1 % 2 == 0)) { gear.backward(900); gear.right(375); gear.forward(); count1++; count2++; } /*if ((ts2.isPressed()) &&(count1 %2 == 2)){ gear.backward(900); gear.right(375); gear.forward(); count1++; }*/ if (ts2.isPressed() && (count2 % 2 != 0)) { // gear.forward(300); // gear.left(375); gear.forward(); } if ((ts2.isPressed()) && (count2 % 2 == 0)) { gear.forward(900); gear.right(375); gear.forward(); } } }