Id: 5880; Nick: n/a; Timestamp: 2008-02-18 22:04:30; Pasted as: Java
Description: n/a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public static void main(String[]input) {
		boolean[][] colonyGather = new boolean[input.length][];
		int i,j;
		int currentLine,longestLine=0;
 
 
		for (i=0;i<input.length;i++) {
			currentLine = input[i].length();
			if (currentLine > longestLine) { 
				longestLine = currentLine;
			}
			colonyGather[i] = new boolean[currentLine];
			for (j=0;j<currentLine;j++) {
				if (input[i].charAt(j) == '*') {
	 				colonyGather[i][j] = true;
				}
			}
		}
 
		int timesRun=0;
		int countChanged=Integer.MAX_VALUE;
 
		colony = new Colony(input.length, longestLine);
		Colony c = new Colony(input.length, longestLine);
		c.colony = colonyGather;
		colony.copyCells(0, 0, c);
 
		Colony temp;
 
		while ((countChanged > 0) && (timesRun < 100)) {
			temp = new Colony(input.length, longestLine);
			countChanged = stepColony(colony,temp);
			timesRun++;
		}
 
		System.out.println(timesRun);
 
	}
Options: New, Download,
;
Copyright © 2006 by Zyberdog - Some rights reserved. (Browse/Disclaimer/Stats/About) - Highlighted with GeSHi