turtle@13: /*********************************************** turtle@13: * icfpc-2011 turtle@13: * بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِِ turtle@13: * Time: 18.06.2011 11:37:46 turtle@13: ***********************************************/ turtle@13: package ru.alphatech.icfpc.game; turtle@13: turtle@14: import java.io.BufferedReader; turtle@15: import java.io.File; turtle@15: import java.io.FileWriter; turtle@14: import java.io.IOException; turtle@14: import java.io.InputStreamReader; turtle@15: import java.io.PrintWriter; akhmetovlz@31: import java.util.ArrayList; akhmetovlz@31: import java.util.LinkedList; akhmetovlz@31: import java.util.List; turtle@14: turtle@13: public class Run turtle@13: { turtle@15: private static boolean endgame = false; turtle@15: turtle@14: private static Player proponent = new Player(); turtle@14: turtle@14: private static Player opponent = new Player(); turtle@14: akhmetovlz@31: private LinkedList batches = new LinkedList(); akhmetovlz@31: akhmetovlz@31: public void clearBatcher(){ akhmetovlz@31: batches.removeAll(batches); akhmetovlz@31: } akhmetovlz@31: akhmetovlz@31: public void addBatcher(List batches){ akhmetovlz@31: this.batches.addAll(this.batches); akhmetovlz@31: } akhmetovlz@31: turtle@14: private static void readOpponent() throws IOException turtle@14: { turtle@14: BufferedReader breader = new BufferedReader(new InputStreamReader(System.in)); turtle@14: turtle@15: String l1 = breader.readLine(); turtle@15: String l2 = breader.readLine(); turtle@15: String l3 = breader.readLine(); turtle@15: turtle@15: if(l1 == null || l2 == null || l3 == null) turtle@15: { turtle@15: endgame = true; turtle@15: } turtle@14: } turtle@14: turtle@14: private static void writeMove() turtle@14: { turtle@15: System.out.print(1 + "\n"); turtle@15: System.out.print("I" + "\n"); turtle@15: System.out.print(0 + "\n"); turtle@14: } turtle@15: turtle@14: public static void main(String[] args) throws IOException turtle@13: { turtle@13: String playerNum = args[0]; turtle@15: turtle@14: if("1".equals(playerNum)) turtle@14: { turtle@14: readOpponent(); turtle@14: } turtle@14: turtle@15: while(!endgame) turtle@15: { turtle@15: writeMove(); turtle@15: readOpponent(); turtle@15: } turtle@13: } turtle@13: }