icfp-model/src/main/java/ru/bosony/model/mine/Mine.java
changeset 30 666821484adc
parent 29 66aa96e8fd92
child 31 6f587e61e1a2
     1.1 --- a/icfp-model/src/main/java/ru/bosony/model/mine/Mine.java	Mon Jul 16 00:05:50 2012 +0400
     1.2 +++ b/icfp-model/src/main/java/ru/bosony/model/mine/Mine.java	Mon Jul 16 01:46:54 2012 +0400
     1.3 @@ -28,21 +28,23 @@
     1.4  	protected Cell[][]			cells;
     1.5  	protected int				sizeX;
     1.6  	protected int				sizeY;
     1.7 -	protected int				waterLevel				= 0;
     1.8 -	protected int				flooding				= 0;
     1.9 -	protected int				robotWaterproof			= 10;
    1.10 -	protected int				growth					= 25;
    1.11 -	protected int				razorsCount				= 0;
    1.12 -	protected static Pattern	minePattern				= Pattern
    1.13 -																.compile("(?s)(.*?)(\n\n(Water.*|Flooding.*|Waterproof.*|Trampoline.*|Growth.*|Razors.*)|$)");
    1.14 -	protected static Pattern	waterPattern			= Pattern.compile("(?s).*(?<=.*Water )(\\d+).*");
    1.15 -	protected static Pattern	floodingPattern			= Pattern.compile("(?s).*(?<=.*Flooding )(\\d+).*");
    1.16 -	protected static Pattern	waterproofPattern		= Pattern.compile("(?s).*(?<=.*Waterproof )(\\d+).*");
    1.17 -	protected static Pattern	growthPattern			= Pattern.compile("(?s).*(?<=.*Growth )(\\d+).*");
    1.18 -	protected static Pattern	razorsPattern			= Pattern.compile("(?s).*(?<=.*Razors )(\\d+).*");
    1.19 -	protected static Pattern	trampolinePattern		= Pattern
    1.20 -																.compile("(?s).*?Trampoline ([A-I]) targets ([1-9]).*");
    1.21 -	protected static String		firstTrampolineRegexp	= "(?s).*?Trampoline ([A-I]) targets ([1-9])";
    1.22 +	protected int				waterLevel							= 0;
    1.23 +	protected int				flooding							= 0;
    1.24 +	protected int				robotWaterproof						= 10;
    1.25 +	protected int				growth								= 25;
    1.26 +	protected int				razorsCount							= 0;
    1.27 +	protected int				lambdasAndHighOrderRocksStartCount	= 0;
    1.28 +	protected static Pattern	minePattern							= Pattern
    1.29 +																			.compile("(?s)(.*?)(\n\n(Water.*|Flooding.*|Waterproof.*|Trampoline.*|Growth.*|Razors.*)|$)");
    1.30 +	protected static Pattern	waterPattern						= Pattern.compile("(?s).*(?<=.*Water )(\\d+).*");
    1.31 +	protected static Pattern	floodingPattern						= Pattern.compile("(?s).*(?<=.*Flooding )(\\d+).*");
    1.32 +	protected static Pattern	waterproofPattern					= Pattern
    1.33 +																			.compile("(?s).*(?<=.*Waterproof )(\\d+).*");
    1.34 +	protected static Pattern	growthPattern						= Pattern.compile("(?s).*(?<=.*Growth )(\\d+).*");
    1.35 +	protected static Pattern	razorsPattern						= Pattern.compile("(?s).*(?<=.*Razors )(\\d+).*");
    1.36 +	protected static Pattern	trampolinePattern					= Pattern
    1.37 +																			.compile("(?s).*?Trampoline ([A-I]) targets ([1-9]).*");
    1.38 +	protected static String		firstTrampolineRegexp				= "(?s).*?Trampoline ([A-I]) targets ([1-9])";
    1.39  
    1.40  	public Mine(String text) {
    1.41  		fromText(text);
    1.42 @@ -52,6 +54,7 @@
    1.43  			throw new RuntimeException("New map does not contain a robot!");
    1.44  		if (findCells(ClosedLambdaLift).size() != 1)
    1.45  			throw new RuntimeException("New map does not contain a ClosedLambdaLift!");
    1.46 +		lambdasAndHighOrderRocksStartCount = findCells(Lambda).size() + findCells(CellContent.HighOrderRock).size();
    1.47  	}
    1.48  
    1.49  	@Override
    1.50 @@ -294,4 +297,8 @@
    1.51  		this.razorsCount = razorsCount;
    1.52  	}
    1.53  
    1.54 +	public int getLambdasAndHighOrderRocksStartCount() {
    1.55 +		return lambdasAndHighOrderRocksStartCount;
    1.56 +	}
    1.57 +
    1.58  }