src/main/java/ru/alphatech/icfpc/game/Player.java
changeset 106 643b85a8a16b
parent 99 60187fe9405d
child 110 d6c063577f0d
equal deleted inserted replaced
105:57368a3d0b15 106:643b85a8a16b
     9 	private Slot[] slots = new Slot[256];
     9 	private Slot[] slots = new Slot[256];
    10 	private Player myOpponent = null;
    10 	private Player myOpponent = null;
    11 
    11 
    12 	public Player()
    12 	public Player()
    13     {
    13     {
    14 		for(int i = 0; i < 255; i++)
    14 		for(int i = 0; i <= 255; i++)
    15 		{
    15 		{
    16 			slots[i] = new Slot(i);
    16 			slots[i] = new Slot(i);
    17 		}
    17 		}
    18     }
    18     }
    19 	
    19 	
    33 	public PlayerStatistic getStatistic(){
    33 	public PlayerStatistic getStatistic(){
    34 		throw new RuntimeException("Not impilemented yet.");
    34 		throw new RuntimeException("Not impilemented yet.");
    35 	}
    35 	}
    36 	
    36 	
    37 	public void applyBatch(Batch batch){
    37 	public void applyBatch(Batch batch){
    38 		switch(batch.operationType){
    38 		Run.setAutoMode(false);
    39 		case CARD_TO_SLOT:
    39 		Run.resetCallCount();
    40 			batch.card.returnValue(getSlot(batch.slot.getId()).getValue(), this, myOpponent);
    40 		try{
    41 			break;
    41 			switch(batch.operationType){
    42 		case SLOT_TO_CARD:
    42 			case CARD_TO_SLOT:
    43 			getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent);
    43 				batch.card.returnValue(getSlot(batch.slot.getId()).getValue(), this, myOpponent);
    44 			break;
    44 				break;
       
    45 			case SLOT_TO_CARD:
       
    46 				getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent);
       
    47 				break;
       
    48 			}
       
    49 		} catch (ICFPCException exception){
       
    50 			getSlot(batch.slot.getId()).putValue(new I());
       
    51 		}
       
    52 		Run.setAutoMode(true);
       
    53 		Run.resetCallCount();
       
    54 		for(Slot slot: myOpponent.slots){
       
    55 			if(slot.isZombie()){
       
    56 				slot.getValue().returnValue(new I(), myOpponent, myOpponent.getMyOpponent());
       
    57 			}
    45 		}
    58 		}
    46 	}
    59 	}
    47 	
    60 	
    48 }
    61 }