package ca.sfu.cmpt431.facility;

public class BoardOperation {

	public static Board NextMoment(Board b, boolean[] up, boolean[] down, boolean[] left, boolean[] right)
	{
		Exception exception = new java.lang.IllegalArgumentException();
		if(up.length != b.width || down.length != b.width)
		{
			System.err.println("Up & down border lengths fail to match the board.");
			throw exception;
		}
		if(left.length != b.height || right.length != b.height)
		{
			System.err.println("Left & right border lengths fail to match the board.");
			throw exception;
		}
		
		return 0;
	}
	
	
	public static void main(String args[])
	{
		
	}
	
	
}

@@ -27,16 +27,78 @@
 ility;%0A%0A
+import java.util.Random;%0A%0Aimport ca.sfu.message.AutomataMsg;%0A%0A
 public c
@@ -619,29 +619,851 @@
 %09%09%7D%0A
+%0A
 %09%09
-%0A%09%09return 0;%0A%09%7D%0A%09%0A%09
+//%09%09auto1.width = width - width/2; //what if width is odd%0A%09%09//%09%09auto1.height = height;%0A%09%09//%09%09int offset = width/2;%0A%09%09//%0A%09%09//%09%09auto1.bitmap = new int%5Bauto1.height%5D%5Bauto1.width%5D;%0A%09%09//%09%09for(int i=0; i%3Cauto1.height; i++)%0A%09%09//%09%09%09for(int j=0; j%3Cauto1.width; j++)%7B%0A%09%09//%09%09%09%09System.out.println(i+%22 %22+j);%0A%09%09//%09%09%09%09auto1.bitmap%5Bi%5D%5Bj%5D = bitmap%5Bi%5D%5Boffset+j%5D;%0A%09%09//%09%09%09%7D%0A%09%09//%09%09return auto1;%0A%09%09return null;%0A%09%7D%0A%0A%09/**%0A%09 * @param %09Input board%0A%09 * @param %09Dense factor ranged from %5B0, 1) --%3E More dense, More cells%0A%09 * @return%09Randomly filled board%0A%09 */%0A%09public static Board Randomize(Board b, double dense)%0A%09%7B%0A%09%09Random random = new Random();%0A%09%09for(int i=0; i%3Cb.height; i++)%0A%09%09%09for(int j=0; j%3Cb.width; j++)%0A%09%09%09%7B%0A%09%09%09%09double sample = random.nextDouble();%0A%09%09%09%09if(sample %3C dense)%0A%09%09%09%09%09b.bitmap%5Bi%5D%5Bj%5D = true;%0A%09%09%09%09else%0A%09%09%09%09%09b.bitmap%5Bi%5D%5Bj%5D = false;%0A%09%09%09%7D%0A%09%09return b;%0A%09%7D%0A
 %0A%09pu
@@ -1506,16 +1506,12 @@
 %0A%09%7B%0A
-%09%09
 %0A%09%7D%0A
-%09%0A%09
+%0A
 %0A%7D%0A

Add Randomized