src/main/java/ru/alphatech/icfpc/game/strategy/HelpStrategy.java
author akhmetovlz
Mon, 20 Jun 2011 15:50:55 +0400
changeset 138 fd3b663230ed
child 139 a2c228686f70
child 140 9ddaa68cccae
permissions -rw-r--r--
Help from example
     1 package ru.alphatech.icfpc.game.strategy;
     2 
     3 import java.util.LinkedList;
     4 
     5 import ru.alphatech.icfpc.cards.I;
     6 import ru.alphatech.icfpc.game.Batch;
     7 import ru.alphatech.icfpc.game.ICFPCException;
     8 import ru.alphatech.icfpc.game.Player;
     9 import ru.alphatech.icfpc.game.Run;
    10 import ru.alphatech.icfpc.game.Batch.OperationType;
    11 import ru.alphatech.icfpc.policy.AttackHelpPolicy;
    12 import ru.alphatech.icfpc.policy.AttackHelpPolicy.TYPE;
    13 
    14 public class HelpStrategy implements IStrategy {
    15 
    16 	LinkedList<Batch> batches = new LinkedList<Batch>();
    17 	
    18 	public HelpStrategy() {
    19 	
    20 		batches.addAll(new AttackHelpPolicy(TYPE.HELP, 0, 0, 1, 16).getBatches());
    21 		
    22 	}
    23 	
    24 	boolean exit = false;
    25 	
    26 	@Override
    27 	public Batch move(Player proponent, Player opponent) {
    28 		Batch batch = batches.poll();
    29 		if(batch != null)
    30 			return batch;
    31 		
    32 		if(exit)
    33 			throw new ICFPCException();
    34 		
    35 		return new Batch(OperationType.CARD_TO_SLOT, new I(), Run.getProponent().getSlot(6));
    36 	}
    37 
    38 }