Help from example
authorakhmetovlz
Mon, 20 Jun 2011 15:50:55 +0400
changeset 138fd3b663230ed
parent 137 9c298049787a
child 139 a2c228686f70
child 140 9ddaa68cccae
Help from example
src/main/java/ru/alphatech/icfpc/game/strategy/HelpStrategy.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/HelpStrategy.java	Mon Jun 20 15:50:55 2011 +0400
     1.3 @@ -0,0 +1,38 @@
     1.4 +package ru.alphatech.icfpc.game.strategy;
     1.5 +
     1.6 +import java.util.LinkedList;
     1.7 +
     1.8 +import ru.alphatech.icfpc.cards.I;
     1.9 +import ru.alphatech.icfpc.game.Batch;
    1.10 +import ru.alphatech.icfpc.game.ICFPCException;
    1.11 +import ru.alphatech.icfpc.game.Player;
    1.12 +import ru.alphatech.icfpc.game.Run;
    1.13 +import ru.alphatech.icfpc.game.Batch.OperationType;
    1.14 +import ru.alphatech.icfpc.policy.AttackHelpPolicy;
    1.15 +import ru.alphatech.icfpc.policy.AttackHelpPolicy.TYPE;
    1.16 +
    1.17 +public class HelpStrategy implements IStrategy {
    1.18 +
    1.19 +	LinkedList<Batch> batches = new LinkedList<Batch>();
    1.20 +	
    1.21 +	public HelpStrategy() {
    1.22 +	
    1.23 +		batches.addAll(new AttackHelpPolicy(TYPE.HELP, 0, 0, 1, 16).getBatches());
    1.24 +		
    1.25 +	}
    1.26 +	
    1.27 +	boolean exit = false;
    1.28 +	
    1.29 +	@Override
    1.30 +	public Batch move(Player proponent, Player opponent) {
    1.31 +		Batch batch = batches.poll();
    1.32 +		if(batch != null)
    1.33 +			return batch;
    1.34 +		
    1.35 +		if(exit)
    1.36 +			throw new ICFPCException();
    1.37 +		
    1.38 +		return new Batch(OperationType.CARD_TO_SLOT, new I(), Run.getProponent().getSlot(6));
    1.39 +	}
    1.40 +
    1.41 +}