src/main/java/ru/alphatech/icfpc/game/Run.java
changeset 88 9555608af847
parent 82 4c6576c03f93
child 90 774e7ce00b5f
child 92 2e69298ad664
equal deleted inserted replaced
87:0f4c762f56f7 88:9555608af847
     6 package ru.alphatech.icfpc.game;
     6 package ru.alphatech.icfpc.game;
     7 
     7 
     8 import java.io.BufferedReader;
     8 import java.io.BufferedReader;
     9 import java.io.IOException;
     9 import java.io.IOException;
    10 import java.io.InputStreamReader;
    10 import java.io.InputStreamReader;
    11 import java.util.LinkedList;
       
    12 import java.util.List;
       
    13 
    11 
    14 import ru.alphatech.icfpc.game.strategy.IStrategy;
    12 import ru.alphatech.icfpc.game.strategy.IStrategy;
    15 import ru.alphatech.icfpc.game.strategy.SimplyStrategy;
    13 import ru.alphatech.icfpc.game.strategy.SimplyStrategy;
    16 
    14 
    17 public class Run
    15 public class Run
    18 {
    16 {
       
    17 	private static boolean automodeapply = false;
       
    18 
    19 	private static boolean endgame = false;
    19 	private static boolean endgame = false;
    20 	
    20 	
    21 	private static Player proponent = new Player();
    21 	private static Player proponent = new Player();
    22 	
    22 	
    23 	private static Player opponent = new Player();
    23 	private static Player opponent = new Player();
    24 	
       
    25 	private static LinkedList<Batch> batches = new LinkedList<Batch>();
       
    26 	
    24 	
    27 	private static int registers[] = new int[4];
    25 	private static int registers[] = new int[4];
    28 	
    26 	
    29 	static {
    27 	static {
    30 		registers[0] = 0;
    28 		registers[0] = 0;
    35 	
    33 	
    36 	private static IStrategy strategy = new SimplyStrategy();
    34 	private static IStrategy strategy = new SimplyStrategy();
    37 	
    35 	
    38 	public static Slot getRegisterByIndex(int registerIdex){
    36 	public static Slot getRegisterByIndex(int registerIdex){
    39 		return proponent.getSlot( registers[registerIdex] );
    37 		return proponent.getSlot( registers[registerIdex] );
    40 	}
       
    41 	
       
    42 	public static void clearBatcher(){
       
    43 		batches.removeAll(batches);
       
    44 	}
       
    45 	
       
    46 	public static void addBatcher(List<Batch> batches){
       
    47 		batches.addAll(batches);
       
    48 	}
    38 	}
    49 	
    39 	
    50 	public static Player getOpponent(){
    40 	public static Player getOpponent(){
    51 		return opponent;
    41 		return opponent;
    52 	}
    42 	}
    86 	private static void writeMove()
    76 	private static void writeMove()
    87     {
    77     {
    88 		strategy.moving(proponent, opponent, System.out);
    78 		strategy.moving(proponent, opponent, System.out);
    89     }
    79     }
    90 	
    80 	
       
    81 	public static boolean getAutoMode()
       
    82 	{
       
    83 		return automodeapply;
       
    84 	}
       
    85 	
    91 	public static void main(String[] args) throws IOException
    86 	public static void main(String[] args) throws IOException
    92     {
    87     {
    93 	    String playerNum = args[0];
    88 	    String playerNum = args[0];
    94 
    89 
    95 	    if("1".equals(playerNum))
    90 	    if("1".equals(playerNum))