src/main/java/ru/alphatech/icfpc/game/Player.java
changeset 106 643b85a8a16b
parent 99 60187fe9405d
child 110 d6c063577f0d
     1.1 --- a/src/main/java/ru/alphatech/icfpc/game/Player.java	Sun Jun 19 19:14:45 2011 +0400
     1.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Player.java	Sun Jun 19 19:44:06 2011 +0400
     1.3 @@ -11,7 +11,7 @@
     1.4  
     1.5  	public Player()
     1.6      {
     1.7 -		for(int i = 0; i < 255; i++)
     1.8 +		for(int i = 0; i <= 255; i++)
     1.9  		{
    1.10  			slots[i] = new Slot(i);
    1.11  		}
    1.12 @@ -35,13 +35,26 @@
    1.13  	}
    1.14  	
    1.15  	public void applyBatch(Batch batch){
    1.16 -		switch(batch.operationType){
    1.17 -		case CARD_TO_SLOT:
    1.18 -			batch.card.returnValue(getSlot(batch.slot.getId()).getValue(), this, myOpponent);
    1.19 -			break;
    1.20 -		case SLOT_TO_CARD:
    1.21 -			getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent);
    1.22 -			break;
    1.23 +		Run.setAutoMode(false);
    1.24 +		Run.resetCallCount();
    1.25 +		try{
    1.26 +			switch(batch.operationType){
    1.27 +			case CARD_TO_SLOT:
    1.28 +				batch.card.returnValue(getSlot(batch.slot.getId()).getValue(), this, myOpponent);
    1.29 +				break;
    1.30 +			case SLOT_TO_CARD:
    1.31 +				getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent);
    1.32 +				break;
    1.33 +			}
    1.34 +		} catch (ICFPCException exception){
    1.35 +			getSlot(batch.slot.getId()).putValue(new I());
    1.36 +		}
    1.37 +		Run.setAutoMode(true);
    1.38 +		Run.resetCallCount();
    1.39 +		for(Slot slot: myOpponent.slots){
    1.40 +			if(slot.isZombie()){
    1.41 +				slot.getValue().returnValue(new I(), myOpponent, myOpponent.getMyOpponent());
    1.42 +			}
    1.43  		}
    1.44  	}
    1.45