src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java
changeset 101 4bb458c3548e
parent 76 5955cb5e5ef3
child 108 4e9f892684f2
     1.1 --- a/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java	Sun Jun 19 18:55:47 2011 +0400
     1.2 +++ b/src/main/java/ru/alphatech/icfpc/policy/AttackHelpPolicy.java	Sun Jun 19 19:13:42 2011 +0400
     1.3 @@ -24,6 +24,7 @@
     1.4  	private int targetSlotIndex  = -1;
     1.5  	private int pointsSlotIndex  = -1;
     1.6  	private int processingSlotIndex = -1;
     1.7 +	private boolean execute = false;
     1.8  	
     1.9  	private TYPE type;
    1.10  	
    1.11 @@ -33,17 +34,19 @@
    1.12  	}
    1.13  	
    1.14  	/**
    1.15 -	 * 
    1.16 +	 * @param type - ATTACK or HELP
    1.17  	 * @param processingSlot - в какой ячейке проводить
    1.18  	 * @param donor - от кого забирать хп
    1.19  	 * @param target - слот который надо атаковать
    1.20  	 * @param points - количество хп отнимаемое у донора
    1.21 +	 * @param execute - выполнить после завершения либо просто сохранить в слоте.
    1.22  	 */
    1.23 -	public AttackHelpPolicy(TYPE type, int processingSlot, int donor, int target, int points) {
    1.24 +	public AttackHelpPolicy(TYPE type, int processingSlot, int donor, int target, int points, boolean execute) {
    1.25  		this.donorSlotIndex  = donor;
    1.26  		this.targetSlotIndex = target;
    1.27  		this.pointsSlotIndex = points;
    1.28  		this.processingSlotIndex = processingSlot;
    1.29 +		this.execute = execute;
    1.30  		
    1.31  		this.type = type;
    1.32  	}
    1.33 @@ -54,9 +57,9 @@
    1.34  		
    1.35  		Slot processingSlot = Run.getProponent().getSlot(processingSlotIndex);
    1.36  		
    1.37 -		numberIntoSlotField(Run.getRegisterByIndex(0), donorSlotIndex);
    1.38 -		numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex);
    1.39 -		numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex);
    1.40 +		retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(0), donorSlotIndex));
    1.41 +		retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(1), targetSlotIndex));
    1.42 +		retArray.addAll(numberIntoSlotField(Run.getRegisterByIndex(2), pointsSlotIndex));
    1.43  		
    1.44  		retArray.addAll(BcombineForFunctWith3ParamsInRegister(getCard(), processingSlot));
    1.45  		
    1.46 @@ -82,9 +85,6 @@
    1.47  		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
    1.48  		
    1.49  		retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Get(), processingSlot));
    1.50 -
    1.51 -		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
    1.52 -		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
    1.53  		
    1.54  		retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
    1.55  		
    1.56 @@ -98,9 +98,6 @@
    1.57  		
    1.58  		retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot));
    1.59  		
    1.60 -		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
    1.61 -		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
    1.62 -		
    1.63  		retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
    1.64  		
    1.65  		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
    1.66 @@ -118,10 +115,8 @@
    1.67  		
    1.68  		retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Succ(), processingSlot));
    1.69  		
    1.70 -		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new K(), processingSlot));
    1.71 -		retArray.add(new Batch(OperationType.CARD_TO_SLOT, new S(), processingSlot));
    1.72 -		
    1.73 -		retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
    1.74 +		if(execute)
    1.75 +			retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), processingSlot));
    1.76  		
    1.77  		return retArray;
    1.78  	}