icfp-solver/src/main/java/ru/bosony/solvers/Solver.java
author indvdum (gotoindvdum[at]gmail[dot]com)
Mon, 16 Jul 2012 04:20:54 +0400
changeset 38 0af2bd7f816a
parent 35 63f356432f75
child 39 27b98e729716
permissions -rw-r--r--
Capturing SIGINT signal
     1 package ru.bosony.solvers;
     2 
     3 import java.io.IOException;
     4 
     5 import ru.bosony.model.mine.Mine;
     6 
     7 /**
     8  * @author indvdum (gotoindvdum[at]gmail[dot]com) <br>
     9  *         16.07.2012 2:16:03
    10  * 
    11  */
    12 public class Solver {
    13 
    14 	protected Mine		mine;
    15 	protected String	route	= "A";
    16 
    17 	public Solver(Mine mine) {
    18 		this.mine = mine;
    19 	}
    20 
    21 	public void start() throws IOException, InterruptedException {
    22 		Runtime.getRuntime().addShutdownHook(new Thread() {
    23 			@Override
    24 			public void run() {
    25 				System.out.println(route);
    26 			}
    27 		});
    28 		// TODO solver
    29 		while (true) {
    30 			Thread.sleep(1000);
    31 		}
    32 	}
    33 
    34 	public static void main(String[] args) throws IOException, InterruptedException {
    35 		String map = "";
    36 		for (String arg : args) {
    37 			map += arg + "\n";
    38 		}
    39 		map = map.replaceAll("\n$", "");
    40 		Mine mine = new Mine(map);
    41 		Solver solver = new Solver(mine);
    42 		solver.start();
    43 	}
    44 
    45 }