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