src/main/java/ru/alphatech/icfpc/game/Run.java
author akhmetovlz
Sun, 19 Jun 2011 11:54:08 +0400
changeset 33 0bf3653484d5
parent 31 7b9682308866
child 34 85894dec2280
permissions -rw-r--r--
батч
     1 /***********************************************
     2  * icfpc-2011
     3  * بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِِ
     4  * Time: 18.06.2011 11:37:46
     5  ***********************************************/
     6 package ru.alphatech.icfpc.game;
     7 
     8 import java.io.BufferedReader;
     9 import java.io.File;
    10 import java.io.FileWriter;
    11 import java.io.IOException;
    12 import java.io.InputStreamReader;
    13 import java.io.PrintWriter;
    14 import java.util.ArrayList;
    15 import java.util.LinkedList;
    16 import java.util.List;
    17 
    18 public class Run
    19 {
    20 	private static boolean endgame = false;
    21 	
    22 	private static Player proponent = new Player();
    23 	
    24 	private static Player opponent = new Player();
    25 	
    26 	private LinkedList<Batch> batches = new LinkedList<Batch>();
    27 	
    28 	public void clearBatcher(){
    29 		batches.removeAll(batches);
    30 	}
    31 	
    32 	public void addBatcher(List<Batch> batches){
    33 		this.batches.addAll(this.batches);
    34 	}
    35 	
    36 	private static void readOpponent() throws IOException
    37 	{
    38 		BufferedReader breader = new BufferedReader(new InputStreamReader(System.in));
    39 		
    40 		String l1 = breader.readLine();
    41 		String l2 = breader.readLine();
    42 		String l3 = breader.readLine();
    43 		
    44 		if(l1 == null || l2 == null || l3 == null)
    45 		{
    46 			endgame = true;
    47 		}
    48 	}
    49 	
    50 	private static void writeMove()
    51     {
    52 		System.out.print(1 + "\n");
    53 		System.out.print("I" + "\n");
    54 		System.out.print(0 + "\n");
    55     }
    56 	
    57 	public static void main(String[] args) throws IOException
    58     {
    59 	    String playerNum = args[0];
    60 
    61 	    if("1".equals(playerNum))
    62 	    {
    63 	    	readOpponent();
    64 	    }
    65 	    
    66 	    while(!endgame)
    67 	    {
    68 		    writeMove();
    69 		    readOpponent();
    70 	    }
    71     }
    72 }