*
authorindvdum
Sun, 19 Jun 2011 17:35:56 +0400
changeset 90774e7ce00b5f
parent 83 5940c7605d03
child 91 179dd516b115
*
src/main/java/ru/alphatech/icfpc/game/Player.java
src/main/java/ru/alphatech/icfpc/game/Run.java
src/main/java/ru/alphatech/icfpc/game/strategy/IStrategy.java
src/main/java/ru/alphatech/icfpc/game/strategy/OtherStrategy.java
src/main/java/ru/alphatech/icfpc/game/strategy/SimplyStrategy.java
     1.1 --- a/src/main/java/ru/alphatech/icfpc/game/Player.java	Sun Jun 19 17:14:19 2011 +0400
     1.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Player.java	Sun Jun 19 17:35:56 2011 +0400
     1.3 @@ -20,17 +20,12 @@
     1.4  		return slots[i];
     1.5  	}
     1.6  	
     1.7 -	public void applyCardToSlot(ICard card, Slot slot){
     1.8 -		throw new RuntimeException("Not impilemented yet.");
     1.9 -	}
    1.10 -	
    1.11 -	public void applySlotToCard(Slot slot, ICard card){
    1.12 -		throw new RuntimeException("Not impilemented yet.");
    1.13 -	}
    1.14 -	
    1.15  	public PlayerStatistic getStatistic(){
    1.16  		throw new RuntimeException("Not impilemented yet.");
    1.17  	}
    1.18  	
    1.19 +	public void applyBatch(Batch batch){
    1.20 +		throw new RuntimeException("Not impilemented yet.");
    1.21 +	}
    1.22  	
    1.23  }
     2.1 --- a/src/main/java/ru/alphatech/icfpc/game/Run.java	Sun Jun 19 17:14:19 2011 +0400
     2.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Run.java	Sun Jun 19 17:35:56 2011 +0400
     2.3 @@ -75,7 +75,9 @@
     2.4  	
     2.5  	private static void writeMove()
     2.6      {
     2.7 -		strategy.moving(proponent, opponent, System.out);
     2.8 +		Batch batch = strategy.move(proponent, opponent);
     2.9 +		System.out.print(batch);
    2.10 +		proponent.applyBatch(batch);
    2.11      }
    2.12  	
    2.13  	public static boolean getAutoMode()
     3.1 --- a/src/main/java/ru/alphatech/icfpc/game/strategy/IStrategy.java	Sun Jun 19 17:14:19 2011 +0400
     3.2 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/IStrategy.java	Sun Jun 19 17:35:56 2011 +0400
     3.3 @@ -1,7 +1,6 @@
     3.4  package ru.alphatech.icfpc.game.strategy;
     3.5  
     3.6 -import java.io.PrintStream;
     3.7 -
     3.8 +import ru.alphatech.icfpc.game.Batch;
     3.9  import ru.alphatech.icfpc.game.Player;
    3.10  
    3.11  /**
    3.12 @@ -10,5 +9,5 @@
    3.13   *
    3.14   */
    3.15  public interface IStrategy {
    3.16 -	public void moving(Player proponent, Player opponent, PrintStream out);
    3.17 +	public Batch move(Player proponent, Player opponent);
    3.18  }
     4.1 --- a/src/main/java/ru/alphatech/icfpc/game/strategy/OtherStrategy.java	Sun Jun 19 17:14:19 2011 +0400
     4.2 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/OtherStrategy.java	Sun Jun 19 17:35:56 2011 +0400
     4.3 @@ -21,8 +21,8 @@
     4.4  	}
     4.5  	
     4.6  	@Override
     4.7 -	public void moving(Player proponent, Player opponent, PrintStream out) {
     4.8 -		out.print(batches.poll());
     4.9 +	public Batch move(Player proponent, Player opponent) {
    4.10 +		return batches.poll();
    4.11  	}
    4.12  
    4.13  }
     5.1 --- a/src/main/java/ru/alphatech/icfpc/game/strategy/SimplyStrategy.java	Sun Jun 19 17:14:19 2011 +0400
     5.2 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/SimplyStrategy.java	Sun Jun 19 17:35:56 2011 +0400
     5.3 @@ -1,11 +1,9 @@
     5.4  package ru.alphatech.icfpc.game.strategy;
     5.5  
     5.6 -import java.io.PrintStream;
     5.7 -
     5.8 +import static ru.alphatech.icfpc.game.Batch.OperationType.CARD_TO_SLOT;
     5.9  import ru.alphatech.icfpc.cards.I;
    5.10  import ru.alphatech.icfpc.game.Batch;
    5.11  import ru.alphatech.icfpc.game.Player;
    5.12 -import static ru.alphatech.icfpc.game.Batch.OperationType.*;
    5.13  
    5.14  /**
    5.15   * @author indvdum
    5.16 @@ -15,9 +13,9 @@
    5.17  public class SimplyStrategy implements IStrategy {
    5.18  
    5.19  	@Override
    5.20 -	public void moving(Player proponent, Player opponent, PrintStream out) {
    5.21 +	public Batch move(Player proponent, Player opponent) {
    5.22  		Batch batch = new Batch(CARD_TO_SLOT, new I(), opponent.getSlot(0));
    5.23 -		out.print(batch);
    5.24 +		return batch;
    5.25  	}
    5.26  
    5.27  }