diff -r 56ba7b1ef026 -r 21f9fa7770cc src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java --- a/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java Sun Jun 19 21:18:00 2011 +0400 +++ b/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java Sun Jun 19 22:41:13 2011 +0400 @@ -61,7 +61,8 @@ retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex)); retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex)); - retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot)); +// retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot)); + retArray.addAll(BcombineForFunctWith3ParamsInRegister2(getCard(), processingSlot)); return retArray; } @@ -70,6 +71,62 @@ return type == TYPE.ATTACK ? new Attack() : new Help(); } + + + /** + * С корректировкой регистров + * @param function + * @param processingSlot + * @return + */ + protected ArrayList BcombineForFunctWith3ParamsInRegister2(ICard function, Slot processingSlot) + { + ArrayList retArray = new ArrayList(); + + if(!(function instanceof Attack || function instanceof Help)){ + throw new ICFPCException(); + } + + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), processingSlot)); + retArray.add(new Batch(OperationType.SLOT_TO_CARD, function, 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 Get(), processingSlot)); + + retArray.addAll(correctRegister(0, processingSlot)); + + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), 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 Get(), processingSlot)); + + retArray.addAll(correctRegister(1, processingSlot)); + + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), 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 Get(), processingSlot)); + + retArray.addAll(correctRegister(2, processingSlot)); + + if(execute) + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot)); + + return retArray; + } + + /*** + * @deprecated + * @param function + * @param processingSlot + * @return + */ protected ArrayList BcombineForFunctWith3ParamsInRegister(ICard function, Slot processingSlot) { ArrayList retArray = new ArrayList(); @@ -78,8 +135,6 @@ throw new ICFPCException(); } - //TODO Абстрагироваться от регистров - retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), processingSlot)); retArray.add(new Batch(OperationType.SLOT_TO_CARD, function, processingSlot)); @@ -122,6 +177,4 @@ return retArray; } - - }