turtle@12: package ru.alphatech.icfpc.game; 0-range@4: indvdum@99: import ru.alphatech.icfpc.cards.I; indvdum@99: akhmetovlz@17: 0-range@4: turtle@11: public class Player 0-range@4: { turtle@28: private Slot[] slots = new Slot[256]; indvdum@99: private Player myOpponent = null; indvdum@99: turtle@28: public Player() turtle@28: { indvdum@106: for(int i = 0; i <= 255; i++) turtle@28: { indvdum@80: slots[i] = new Slot(i); turtle@28: } turtle@28: } turtle@28: indvdum@99: public Player getMyOpponent() { indvdum@99: return myOpponent; indvdum@99: } indvdum@99: indvdum@99: public void setMyOpponent(Player myOpponent) { indvdum@99: this.myOpponent = myOpponent; indvdum@99: } indvdum@99: turtle@11: public Slot getSlot(int i) turtle@11: { turtle@28: return slots[i]; turtle@11: } akhmetovlz@17: akhmetovlz@19: public PlayerStatistic getStatistic(){ akhmetovlz@19: throw new RuntimeException("Not impilemented yet."); akhmetovlz@19: } akhmetovlz@30: indvdum@90: public void applyBatch(Batch batch){ indvdum@106: Run.setAutoMode(false); indvdum@106: Run.resetCallCount(); indvdum@106: try{ indvdum@106: switch(batch.operationType){ indvdum@106: case CARD_TO_SLOT: indvdum@106: batch.card.returnValue(getSlot(batch.slot.getId()).getValue(), this, myOpponent); indvdum@106: break; indvdum@106: case SLOT_TO_CARD: indvdum@106: getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent); indvdum@106: break; indvdum@106: } indvdum@106: } catch (ICFPCException exception){ indvdum@106: getSlot(batch.slot.getId()).putValue(new I()); indvdum@106: } indvdum@106: Run.setAutoMode(true); indvdum@106: Run.resetCallCount(); indvdum@106: for(Slot slot: myOpponent.slots){ indvdum@106: if(slot.isZombie()){ indvdum@106: slot.getValue().returnValue(new I(), myOpponent, myOpponent.getMyOpponent()); indvdum@106: } indvdum@99: } indvdum@90: } akhmetovlz@30: 0-range@4: }