1.1 --- a/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java Sun Jun 19 21:18:00 2011 +0400
1.2 +++ b/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java Sun Jun 19 22:41:13 2011 +0400
1.3 @@ -61,7 +61,8 @@
1.4 retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex));
1.5 retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex));
1.6
1.7 - retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot));
1.8 +// retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot));
1.9 + retArray.addAll(BcombineForFunctWith3ParamsInRegister2(getCard(), processingSlot));
1.10
1.11 return retArray;
1.12 }
1.13 @@ -70,6 +71,62 @@
1.14 return type == TYPE.ATTACK ? new Attack() : new Help();
1.15 }
1.16
1.17 +
1.18 +
1.19 + /**
1.20 + * С корректировкой регистров
1.21 + * @param function
1.22 + * @param processingSlot
1.23 + * @return
1.24 + */
1.25 + protected ArrayList<Batch> BcombineForFunctWith3ParamsInRegister2(ICard function, Slot processingSlot)
1.26 + {
1.27 + ArrayList<Batch> retArray = new ArrayList<Batch>();
1.28 +
1.29 + if(!(function instanceof Attack || function instanceof Help)){
1.30 + throw new ICFPCException();
1.31 + }
1.32 +
1.33 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), processingSlot));
1.34 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, function, processingSlot));
1.35 +
1.36 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
1.37 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
1.38 +
1.39 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot));
1.40 +
1.41 + retArray.addAll(correctRegister(0, processingSlot));
1.42 +
1.43 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
1.44 +
1.45 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
1.46 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
1.47 +
1.48 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot));
1.49 +
1.50 + retArray.addAll(correctRegister(1, processingSlot));
1.51 +
1.52 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
1.53 +
1.54 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
1.55 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
1.56 +
1.57 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot));
1.58 +
1.59 + retArray.addAll(correctRegister(2, processingSlot));
1.60 +
1.61 + if(execute)
1.62 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
1.63 +
1.64 + return retArray;
1.65 + }
1.66 +
1.67 + /***
1.68 + * @deprecated
1.69 + * @param function
1.70 + * @param processingSlot
1.71 + * @return
1.72 + */
1.73 protected ArrayList<Batch> BcombineForFunctWith3ParamsInRegister(ICard function, Slot processingSlot)
1.74 {
1.75 ArrayList<Batch> retArray = new ArrayList<Batch>();
1.76 @@ -78,8 +135,6 @@
1.77 throw new ICFPCException();
1.78 }
1.79
1.80 - //TODO Абстрагироваться от регистров
1.81 -
1.82 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), processingSlot));
1.83 retArray.add(new Batch(OperationType.SLOT_TO_CARD, function, processingSlot));
1.84
1.85 @@ -122,6 +177,4 @@
1.86
1.87 return retArray;
1.88 }
1.89 -
1.90 -
1.91 }