Saving raw metadata string for next using
authorindvdum (gotoindvdum[at]gmail[dot]com)
Mon, 16 Jul 2012 01:58:08 +0400
changeset 316f587e61e1a2
parent 30 666821484adc
child 32 e72da42d4d58
Saving raw metadata string for next using
icfp-model/src/main/java/ru/bosony/model/mine/Mine.java
     1.1 --- a/icfp-model/src/main/java/ru/bosony/model/mine/Mine.java	Mon Jul 16 01:46:54 2012 +0400
     1.2 +++ b/icfp-model/src/main/java/ru/bosony/model/mine/Mine.java	Mon Jul 16 01:58:08 2012 +0400
     1.3 @@ -34,6 +34,7 @@
     1.4  	protected int				growth								= 25;
     1.5  	protected int				razorsCount							= 0;
     1.6  	protected int				lambdasAndHighOrderRocksStartCount	= 0;
     1.7 +	protected String			metadata							= "";
     1.8  	protected static Pattern	minePattern							= Pattern
     1.9  																			.compile("(?s)(.*?)(\n\n(Water.*|Flooding.*|Waterproof.*|Trampoline.*|Growth.*|Razors.*)|$)");
    1.10  	protected static Pattern	waterPattern						= Pattern.compile("(?s).*(?<=.*Water )(\\d+).*");
    1.11 @@ -68,22 +69,7 @@
    1.12  		}
    1.13  		text = text.replaceAll("\n*$", "");
    1.14  		text += "\n\n";
    1.15 -		if (waterLevel != 0) {
    1.16 -			text += "Water " + waterLevel + "\n";
    1.17 -		}
    1.18 -		if (flooding != 0) {
    1.19 -			text += "Flooding " + flooding + "\n";
    1.20 -		}
    1.21 -		text += "Waterproof " + robotWaterproof + "\n";
    1.22 -		for (CellContent trampoline : CellContent.values()) {
    1.23 -			if (trampoline.getTrampolineTarget() != null)
    1.24 -				text += "Trampoline " + trampoline.toText() + " targets " + trampoline.getTrampolineTarget().toText()
    1.25 -						+ "\n";
    1.26 -		}
    1.27 -		text += "Growth " + growth + "\n";
    1.28 -		if (razorsCount != 0) {
    1.29 -			text += "Razors " + razorsCount + "\n";
    1.30 -		}
    1.31 +		text += metadata;
    1.32  		text = text.replaceAll("\n*$", "");
    1.33  		return text;
    1.34  	}
    1.35 @@ -118,7 +104,7 @@
    1.36  			}
    1.37  		}
    1.38  
    1.39 -		String metadata = matcher.group(3);
    1.40 +		metadata = matcher.group(3);
    1.41  		if (metadata != null) {
    1.42  			// Water flooding
    1.43  			String sWaterLevel = "";
    1.44 @@ -174,7 +160,8 @@
    1.45  				growth = Integer.parseInt(sGrowth);
    1.46  			if (sRazors.length() > 0)
    1.47  				razorsCount = Integer.parseInt(sRazors);
    1.48 -		}
    1.49 +		} else
    1.50 +			metadata = "";
    1.51  	}
    1.52  
    1.53  	public Cell getCell(Coordinate coordinate) {