1.1 --- a/src/main/java/ru/alphatech/icfpc/game/Run.java Sun Jun 19 17:46:57 2011 +0400
1.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Run.java Sun Jun 19 17:47:28 2011 +0400
1.3 @@ -33,8 +33,12 @@
1.4
1.5 private static IStrategy strategy = new SimplyStrategy();
1.6
1.7 - public static Slot getRegisterByIndex(int registerIdex){
1.8 - return proponent.getSlot( registers[registerIdex] );
1.9 + public static Slot getRegisterByIndex(int registerIndex){
1.10 + return proponent.getSlot( registers[registerIndex] );
1.11 + }
1.12 +
1.13 + public static int getRegisterSlotNum(int registerIndex ){
1.14 + return registers[registerIndex];
1.15 }
1.16
1.17 public static Player getOpponent(){
2.1 --- a/src/main/java/ru/alphatech/icfpc/policy/ZombiePolicy.java Sun Jun 19 17:46:57 2011 +0400
2.2 +++ b/src/main/java/ru/alphatech/icfpc/policy/ZombiePolicy.java Sun Jun 19 17:47:28 2011 +0400
2.3 @@ -2,14 +2,74 @@
2.4
2.5 import java.util.ArrayList;
2.6
2.7 +import ru.alphatech.icfpc.cards.Get;
2.8 +import ru.alphatech.icfpc.cards.K;
2.9 +import ru.alphatech.icfpc.cards.Put;
2.10 +import ru.alphatech.icfpc.cards.S;
2.11 +import ru.alphatech.icfpc.cards.Succ;
2.12 +import ru.alphatech.icfpc.cards.Zero;
2.13 +import ru.alphatech.icfpc.cards.Zombie;
2.14 import ru.alphatech.icfpc.game.AbstractPolicy;
2.15 import ru.alphatech.icfpc.game.Batch;
2.16 +import ru.alphatech.icfpc.game.Run;
2.17 +import ru.alphatech.icfpc.game.Slot;
2.18 +import ru.alphatech.icfpc.game.Batch.OperationType;
2.19
2.20 public class ZombiePolicy extends AbstractPolicy {
2.21 +
2.22 + private int processingSlotIndex = -1;
2.23 + private int targetSlotIndex = -1;
2.24 + private int valueSlotIndex = -1;
2.25 +
2.26 + /**
2.27 + *
2.28 + * @param processingSlotIndex - слот в котором выполниться процесс зомбирования =)
2.29 + * @param targetSlot - слот который будет зомби
2.30 + * @param valueSlot слот в котором лежит содержиме которое поместиться в зомби
2.31 + */
2.32 + public ZombiePolicy(int processingSlotIndex, int targetSlot, int valueSlot) {
2.33 + this.processingSlotIndex = processingSlotIndex;
2.34 + this.targetSlotIndex = targetSlot;
2.35 + this.valueSlotIndex = valueSlot;
2.36 + }
2.37
2.38 @Override
2.39 public ArrayList<Batch> getBatches() {
2.40 - return null;
2.41 + ArrayList<Batch> retArray = new ArrayList<Batch>();
2.42 +
2.43 + numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex);
2.44 + Slot processingSlot = Run.getProponent().getSlot(processingSlotIndex);
2.45 +
2.46 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), processingSlot));
2.47 +
2.48 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zombie(), processingSlot));
2.49 +
2.50 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
2.51 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
2.52 +
2.53 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot));
2.54 +
2.55 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
2.56 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
2.57 +
2.58 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
2.59 +
2.60 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
2.61 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
2.62 +
2.63 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot));
2.64 +
2.65 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
2.66 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
2.67 +
2.68 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot));
2.69 +
2.70 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
2.71 + retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
2.72 +
2.73 + retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
2.74 +
2.75 + return retArray;
2.76 }
2.77
2.78 }