Merge with 388fac62b96eee267631d4f2c42e42a953044303
authorakhmetovlz
Mon, 20 Jun 2011 03:25:06 +0400
changeset 134c686931ff47e
parent 133 efaeeba4c99c
parent 130 388fac62b96e
child 135 a6e17b7f4506
Merge with 388fac62b96eee267631d4f2c42e42a953044303
src/main/java/ru/alphatech/icfpc/game/Run.java
     1.1 --- a/src/main/java/ru/alphatech/icfpc/cards/AbstractCard.java	Mon Jun 20 03:24:53 2011 +0400
     1.2 +++ b/src/main/java/ru/alphatech/icfpc/cards/AbstractCard.java	Mon Jun 20 03:25:06 2011 +0400
     1.3 @@ -26,5 +26,9 @@
     1.4  		}
     1.5  	}
     1.6  	
     1.7 -	
     1.8 +	@Override
     1.9 +	public String toString()
    1.10 +	{
    1.11 +		return getName();
    1.12 +	}
    1.13  }
     2.1 --- a/src/main/java/ru/alphatech/icfpc/game/Player.java	Mon Jun 20 03:24:53 2011 +0400
     2.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Player.java	Mon Jun 20 03:25:06 2011 +0400
     2.3 @@ -64,10 +64,10 @@
     2.4  					batch.card = (ICard) new Value(0);
     2.5  				}
     2.6  
     2.7 -				batch.card.returnValue(value, this, myOpponent);
     2.8 +				getSlot(batch.slot.getId()).putValue(batch.card.returnValue(value, this, myOpponent));
     2.9  				break;
    2.10  			case SLOT_TO_CARD:
    2.11 -				getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent);
    2.12 +				getSlot(batch.slot.getId()).putValue(getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent));
    2.13  				break;
    2.14  			}
    2.15  		} catch (ICFPCException exception){
     3.1 --- a/src/main/java/ru/alphatech/icfpc/game/Run.java	Mon Jun 20 03:24:53 2011 +0400
     3.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Run.java	Mon Jun 20 03:25:06 2011 +0400
     3.3 @@ -84,7 +84,8 @@
     3.4  	
     3.5  	private static void readOpponent() throws IOException
     3.6  	{
     3.7 -		String[] readData = doRealRead();
     3.8 +		//String[] readData = doRealRead();
     3.9 +		String[] readData = doDebugRead();
    3.10  		String sTurnCase = readData[0];
    3.11  		String sCard = null;
    3.12  		String sSlot = null;
     4.1 --- a/src/main/java/ru/alphatech/icfpc/game/Slot.java	Mon Jun 20 03:24:53 2011 +0400
     4.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Slot.java	Mon Jun 20 03:25:06 2011 +0400
     4.3 @@ -48,4 +48,10 @@
     4.4  	{
     4.5  		_value = value;
     4.6  	}
     4.7 +	
     4.8 +	@Override
     4.9 +	public String toString()
    4.10 +	{
    4.11 +		return getId() + "={" + getVitality() + "," + getValue() + "}";
    4.12 +	}
    4.13  }
     5.1 --- a/src/main/java/ru/alphatech/icfpc/game/Value.java	Mon Jun 20 03:24:53 2011 +0400
     5.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Value.java	Mon Jun 20 03:25:06 2011 +0400
     5.3 @@ -25,4 +25,10 @@
     5.4  	{
     5.5  		throw new ICFPCException();
     5.6  	}
     5.7 +	
     5.8 +	@Override
     5.9 +	public String toString()
    5.10 +	{
    5.11 +		return "" + _value;
    5.12 +	}
    5.13  }
     6.1 --- a/src/main/java/ru/alphatech/icfpc/game/strategy/YetAnotherStrategy.java	Mon Jun 20 03:24:53 2011 +0400
     6.2 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/YetAnotherStrategy.java	Mon Jun 20 03:25:06 2011 +0400
     6.3 @@ -9,6 +9,7 @@
     6.4  
     6.5  import ru.alphatech.icfpc.game.Batch;
     6.6  import ru.alphatech.icfpc.game.Player;
     6.7 +import ru.alphatech.icfpc.game.Value;
     6.8  import ru.alphatech.icfpc.policy.AttackHelpPolicy;
     6.9  import ru.alphatech.icfpc.policy.CallExpressionPolicy;
    6.10  
    6.11 @@ -64,8 +65,14 @@
    6.12  		for(int i = 0; i <= 255; i++)
    6.13  			if(proponent.getSlot(i).getVitality() != 10000)
    6.14  				log.println("proponent slot " + (i) + " has " + proponent.getSlot(i).getVitality() + " vitality");
    6.15 -		helpPolicy = new AttackHelpPolicy(AttackHelpPolicy.TYPE.HELP, 7, lastUsedSlot++, 6, 5000);
    6.16 -		batches.addAll(helpPolicy.getBatches());
    6.17 +		if(
    6.18 +				proponent.getSlot(6).getValue() instanceof Value && 
    6.19 +				opponent.getSlot(lastAttackedSlot - 1).getValue() instanceof Value && 
    6.20 +				((Value)proponent.getSlot(6).getValue()).getValue() * 1.1 < ((Value)opponent.getSlot(lastAttackedSlot - 1).getValue()).getValue()
    6.21 +				){
    6.22 +			helpPolicy = new AttackHelpPolicy(AttackHelpPolicy.TYPE.HELP, 7, lastUsedSlot++, 6, 5000);
    6.23 +			batches.addAll(helpPolicy.getBatches());
    6.24 +		}
    6.25  		attackPolicy = new AttackHelpPolicy(AttackHelpPolicy.TYPE.ATTACK, 5, 6, lastAttackedSlot-1, 4000);
    6.26  		batches.addAll(attackPolicy.getBatches());
    6.27  //		batches.addAll(callAttack.getBatches());