# HG changeset patch # User akhmetovlz # Date 1308570655 -14400 # Node ID fd3b663230ed3c0e27eb02ae4dc2f41336d9912c # Parent 9c298049787a45036f2253be5e9c1b068be5ea1b Help from example diff -r 9c298049787a -r fd3b663230ed src/main/java/ru/alphatech/icfpc/game/strategy/HelpStrategy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/HelpStrategy.java Mon Jun 20 15:50:55 2011 +0400 @@ -0,0 +1,38 @@ +package ru.alphatech.icfpc.game.strategy; + +import java.util.LinkedList; + +import ru.alphatech.icfpc.cards.I; +import ru.alphatech.icfpc.game.Batch; +import ru.alphatech.icfpc.game.ICFPCException; +import ru.alphatech.icfpc.game.Player; +import ru.alphatech.icfpc.game.Run; +import ru.alphatech.icfpc.game.Batch.OperationType; +import ru.alphatech.icfpc.policy.AttackHelpPolicy; +import ru.alphatech.icfpc.policy.AttackHelpPolicy.TYPE; + +public class HelpStrategy implements IStrategy { + + LinkedList batches = new LinkedList(); + + public HelpStrategy() { + + batches.addAll(new AttackHelpPolicy(TYPE.HELP, 0, 0, 1, 16).getBatches()); + + } + + boolean exit = false; + + @Override + public Batch move(Player proponent, Player opponent) { + Batch batch = batches.poll(); + if(batch != null) + return batch; + + if(exit) + throw new ICFPCException(); + + return new Batch(OperationType.CARD_TO_SLOT, new I(), Run.getProponent().getSlot(6)); + } + +}