diff -r ecaee9f1a2be -r 57368a3d0b15 src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java --- a/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java Sun Jun 19 19:14:10 2011 +0400 +++ b/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java Sun Jun 19 19:14:45 2011 +0400 @@ -24,6 +24,7 @@ private int targetSlotIndex = -1; private int pointsSlotIndex = -1; private int processingSlotIndex = -1; + private boolean execute = false; private TYPE type; @@ -33,17 +34,19 @@ } /** - * + * @param type - ATTACK or HELP * @param processingSlot - в какой ячейке проводить * @param donor - от кого забирать хп * @param target - слот который надо атаковать * @param points - количество хп отнимаемое у донора + * @param execute - выполнить после завершения либо просто сохранить в слоте. */ - public AttackHelpPolicy(TYPE type, int processingSlot, int donor, int target, int points) { + public AttackHelpPolicy(TYPE type, int processingSlot, int donor, int target, int points, boolean execute) { this.donorSlotIndex = donor; this.targetSlotIndex = target; this.pointsSlotIndex = points; this.processingSlotIndex = processingSlot; + this.execute = execute; this.type = type; } @@ -54,9 +57,9 @@ Slot processingSlot = Run.getProponent().getSlot(processingSlotIndex); - numberIntoSlotField(Run.getRegisterByIndex(0), donorSlotIndex); - numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex); - numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex); + retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(0), donorSlotIndex)); + retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex)); + retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex)); retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot)); @@ -82,9 +85,6 @@ retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot)); - - retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); - retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); @@ -98,9 +98,6 @@ retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot)); - retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); - retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); - retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); @@ -118,10 +115,8 @@ retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot)); - retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot)); - retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot)); - - retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); + if(execute) + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); return retArray; }