Call Count.
1 /***********************************************
3 * بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِِ
4 * Time: 18.06.2011 11:37:46
5 ***********************************************/
6 package ru.alphatech.icfpc.game;
8 import java.io.BufferedReader;
9 import java.io.IOException;
10 import java.io.InputStreamReader;
12 import ru.alphatech.icfpc.cards.Attack;
13 import ru.alphatech.icfpc.cards.Copy;
14 import ru.alphatech.icfpc.cards.Dbl;
15 import ru.alphatech.icfpc.cards.Dec;
16 import ru.alphatech.icfpc.cards.Get;
17 import ru.alphatech.icfpc.cards.Help;
18 import ru.alphatech.icfpc.cards.I;
19 import ru.alphatech.icfpc.cards.ICard;
20 import ru.alphatech.icfpc.cards.Inc;
21 import ru.alphatech.icfpc.cards.K;
22 import ru.alphatech.icfpc.cards.Put;
23 import ru.alphatech.icfpc.cards.Revive;
24 import ru.alphatech.icfpc.cards.S;
25 import ru.alphatech.icfpc.cards.Succ;
26 import ru.alphatech.icfpc.cards.Zero;
27 import ru.alphatech.icfpc.cards.Zombie;
28 import ru.alphatech.icfpc.game.Batch.OperationType;
29 import ru.alphatech.icfpc.game.strategy.IStrategy;
30 import ru.alphatech.icfpc.game.strategy.SimplyStrategy;
34 private static int callcount = 0;
36 private static boolean automodeapply = false;
38 private static boolean endgame = false;
40 private static Player proponent = new Player();
42 private static Player opponent = new Player();
44 private static int registers[] = new int[4];
53 private static IStrategy strategy = new SimplyStrategy();
55 public static Slot getRegisterByIndex(int registerIndex){
56 return proponent.getSlot( registers[registerIndex] );
59 public static int getRegisterSlotNum(int registerIndex ){
60 return registers[registerIndex];
63 public static Player getOpponent(){
67 public static Player getProponent(){
71 private static void readOpponent() throws IOException
73 BufferedReader breader = new BufferedReader(new InputStreamReader(System.in));
74 String sTurnCase = breader.readLine();
78 OperationType operationType = null;
82 if("1".equals(sTurnCase))
84 sCard = breader.readLine();
85 sSlot = breader.readLine();
86 operationType = OperationType.CARD_TO_SLOT;
88 else if("2".equals(sTurnCase))
90 sSlot = breader.readLine();
91 sCard = breader.readLine();
92 operationType = OperationType.SLOT_TO_CARD;
99 if(sTurnCase == null || sCard == null || sSlot == null)
105 slot = opponent.getSlot(Integer.parseInt(sSlot));
106 for(ICard iCard: new ICard[]{
123 if(sCard.equals(iCard.getName())){
128 Batch batch = new Batch(operationType, card, slot);
129 opponent.applyBatch(batch);
132 private static void writeMove()
134 Batch batch = strategy.move(proponent, opponent);
135 System.out.print(batch);
136 proponent.applyBatch(batch);
139 public static void resetCallCount()
144 public static int incCallCount()
151 public static boolean getAutoMode()
153 return automodeapply;
156 public static void main(String[] args) throws IOException
158 String playerNum = args[0];
160 if("1".equals(playerNum))