1.1 --- a/src/main/java/ru/alphatech/icfpc/game/Run.java Sun Jun 19 13:25:00 2011 +0400
1.2 +++ b/src/main/java/ru/alphatech/icfpc/game/Run.java Sun Jun 19 13:37:56 2011 +0400
1.3 @@ -11,6 +11,9 @@
1.4 import java.util.LinkedList;
1.5 import java.util.List;
1.6
1.7 +import ru.alphatech.icfpc.game.strategy.IStrategy;
1.8 +import ru.alphatech.icfpc.game.strategy.SimplyStrategy;
1.9 +
1.10 public class Run
1.11 {
1.12 private static boolean endgame = false;
1.13 @@ -30,6 +33,8 @@
1.14 registers[3] = 3;
1.15 }
1.16
1.17 + private static IStrategy strategy = new SimplyStrategy();
1.18 +
1.19 public static Slot getRegisterByIndex(int registerIdex){
1.20 return proponent.getSlot( registers[registerIdex] );
1.21 }
1.22 @@ -80,9 +85,7 @@
1.23
1.24 private static void writeMove()
1.25 {
1.26 - System.out.print(1 + "\n");
1.27 - System.out.print("I" + "\n");
1.28 - System.out.print(0 + "\n");
1.29 + strategy.moving(proponent, opponent, System.out);
1.30 }
1.31
1.32 public static void main(String[] args) throws IOException
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/IStrategy.java Sun Jun 19 13:37:56 2011 +0400
2.3 @@ -0,0 +1,14 @@
2.4 +package ru.alphatech.icfpc.game.strategy;
2.5 +
2.6 +import java.io.PrintStream;
2.7 +
2.8 +import ru.alphatech.icfpc.game.Player;
2.9 +
2.10 +/**
2.11 + * @author indvdum
2.12 + * 19.06.2011 13:36:17
2.13 + *
2.14 + */
2.15 +public interface IStrategy {
2.16 + public void moving(Player proponent, Player opponent, PrintStream out);
2.17 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/src/main/java/ru/alphatech/icfpc/game/strategy/SimplyStrategy.java Sun Jun 19 13:37:56 2011 +0400
3.3 @@ -0,0 +1,21 @@
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.Player;
3.9 +
3.10 +/**
3.11 + * @author indvdum
3.12 + * 19.06.2011 13:36:26
3.13 + *
3.14 + */
3.15 +public class SimplyStrategy implements IStrategy {
3.16 +
3.17 + @Override
3.18 + public void moving(Player proponent, Player opponent, PrintStream out) {
3.19 + out.print(1 + "\n");
3.20 + out.print("I" + "\n");
3.21 + out.print(0 + "\n");
3.22 + }
3.23 +
3.24 +}