icfp-model/src/main/java/ru/bosony/model/mine/Mine.java
branchCleverSearch
changeset 50 9530f55e9639
parent 46 4197f736166a
child 51 b431cec961d7
equal deleted inserted replaced
49:70cfa8a066df 50:9530f55e9639
    46 	protected static Pattern	trampolinePattern					= Pattern
    46 	protected static Pattern	trampolinePattern					= Pattern
    47 																			.compile("(?s).*?Trampoline ([A-I]) targets ([1-9]).*");
    47 																			.compile("(?s).*?Trampoline ([A-I]) targets ([1-9]).*");
    48 	protected static String		firstTrampolineRegexp				= "(?s).*?Trampoline ([A-I]) targets ([1-9])";
    48 	protected static String		firstTrampolineRegexp				= "(?s).*?Trampoline ([A-I]) targets ([1-9])";
    49 
    49 
    50 	public Mine(String text) {
    50 	public Mine(String text) {
    51 		fromText(text);
    51 		this(text, null);
    52 		if (findCells(OpenLambdaLift).size() != 0)
    52 		if (findCells(OpenLambdaLift).size() != 0)
    53 			throw new RuntimeException("Detected OpenLambdaLift in new map!");
    53 			throw new RuntimeException("Detected OpenLambdaLift in new map!");
    54 		if (findCells(MiningRobot).size() != 1)
    54 		if (findCells(MiningRobot).size() != 1)
    55 			throw new RuntimeException("New map does not contain a robot!");
    55 			throw new RuntimeException("New map does not contain a robot!");
    56 		if (findCells(ClosedLambdaLift).size() != 1)
    56 		if (findCells(ClosedLambdaLift).size() != 1)
    57 			throw new RuntimeException("New map does not contain a ClosedLambdaLift!");
    57 			throw new RuntimeException("New map does not contain a ClosedLambdaLift!");
       
    58 	}
       
    59 
       
    60 	protected Mine(String text, Object obj) {
       
    61 		fromText(text);
    58 		lambdasAndHighOrderRocksStartCount = findCells(Lambda).size() + findCells(CellContent.HighOrderRock).size();
    62 		lambdasAndHighOrderRocksStartCount = findCells(Lambda).size() + findCells(CellContent.HighOrderRock).size();
    59 	}
    63 	}
    60 
    64 
    61 	@Override
    65 	@Override
    62 	public String toText() {
    66 	public String toText() {
   308 	public int hashCode() {
   312 	public int hashCode() {
   309 		return toText().hashCode();
   313 		return toText().hashCode();
   310 	}
   314 	}
   311 
   315 
   312 	@Override
   316 	@Override
   313 	public Mine clone() throws CloneNotSupportedException {
   317 	public Mine clone() {
   314 		return new Mine(toText());
   318 		return new Mine(toText(), null);
   315 	}
   319 	}
   316 
   320 
   317 }
   321 }