1.1 --- a/src/main/java/ru/alphatech/icfpc/game/Run.java Sun Jun 19 17:47:28 2011 +0400
1.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Run.java Sun Jun 19 18:16:08 2011 +0400
1.3 @@ -9,6 +9,23 @@
1.4 import java.io.IOException;
1.5 import java.io.InputStreamReader;
1.6
1.7 +import ru.alphatech.icfpc.cards.Attack;
1.8 +import ru.alphatech.icfpc.cards.Copy;
1.9 +import ru.alphatech.icfpc.cards.Dbl;
1.10 +import ru.alphatech.icfpc.cards.Dec;
1.11 +import ru.alphatech.icfpc.cards.Get;
1.12 +import ru.alphatech.icfpc.cards.Help;
1.13 +import ru.alphatech.icfpc.cards.I;
1.14 +import ru.alphatech.icfpc.cards.ICard;
1.15 +import ru.alphatech.icfpc.cards.Inc;
1.16 +import ru.alphatech.icfpc.cards.K;
1.17 +import ru.alphatech.icfpc.cards.Put;
1.18 +import ru.alphatech.icfpc.cards.Revive;
1.19 +import ru.alphatech.icfpc.cards.S;
1.20 +import ru.alphatech.icfpc.cards.Succ;
1.21 +import ru.alphatech.icfpc.cards.Zero;
1.22 +import ru.alphatech.icfpc.cards.Zombie;
1.23 +import ru.alphatech.icfpc.game.Batch.OperationType;
1.24 import ru.alphatech.icfpc.game.strategy.IStrategy;
1.25 import ru.alphatech.icfpc.game.strategy.SimplyStrategy;
1.26
1.27 @@ -52,32 +69,62 @@
1.28 private static void readOpponent() throws IOException
1.29 {
1.30 BufferedReader breader = new BufferedReader(new InputStreamReader(System.in));
1.31 - String turnCase = breader.readLine();
1.32 - String card = null;
1.33 - String slot = null;
1.34 + String sTurnCase = breader.readLine();
1.35 + String sCard = null;
1.36 + String sSlot = null;
1.37
1.38 - if("1".equals(turnCase))
1.39 + OperationType operationType = null;
1.40 + ICard card = null;
1.41 + Slot slot = null;
1.42 +
1.43 + if("1".equals(sTurnCase))
1.44 {
1.45 - card = breader.readLine();
1.46 - slot = breader.readLine();
1.47 + sCard = breader.readLine();
1.48 + sSlot = breader.readLine();
1.49 + operationType = OperationType.CARD_TO_SLOT;
1.50 }
1.51 - else if("2".equals(turnCase))
1.52 + else if("2".equals(sTurnCase))
1.53 {
1.54 - slot = breader.readLine();
1.55 - card = breader.readLine();
1.56 + sSlot = breader.readLine();
1.57 + sCard = breader.readLine();
1.58 + operationType = OperationType.SLOT_TO_CARD;
1.59 }
1.60 else
1.61 {
1.62 // do nothing
1.63 }
1.64
1.65 - if(turnCase == null || card == null || slot == null)
1.66 + if(sTurnCase == null || sCard == null || sSlot == null)
1.67 {
1.68 endgame = true;
1.69 return;
1.70 }
1.71
1.72 -
1.73 + slot = opponent.getSlot(Integer.parseInt(sSlot));
1.74 + for(ICard iCard: new ICard[]{
1.75 + new Attack(),
1.76 + new Copy(),
1.77 + new Dbl(),
1.78 + new Dec(),
1.79 + new Get(),
1.80 + new Help(),
1.81 + new I(),
1.82 + new Inc(),
1.83 + new K(),
1.84 + new Put(),
1.85 + new Revive(),
1.86 + new S(),
1.87 + new Succ(),
1.88 + new Zero(),
1.89 + new Zombie(),
1.90 + }){
1.91 + if(sCard.equals(iCard.getName())){
1.92 + card = iCard;
1.93 + break;
1.94 + }
1.95 + }
1.96 + Batch batch = new Batch(operationType, card, slot);
1.97 + opponent.applyBatch(batch);
1.98 }
1.99
1.100 private static void writeMove()