public void iterate(){ 
		switch(interrupt){
			case 0: break;
			default: controller.iterateInterrupt(interrupt); interrupt = 0; break;
		}
		switch(aamode){
		case 1: pete.iterate(); break;
		case 2: for(int h = 0; h <= gridy-1; h++){
						for(int w = 0; w <= gridx-1; w++){
							grid[w][h].checkRules();
							grid[w][h].calculateState();}}	
				for(int h = 0; h <= gridy-1; h++){
						for(int w = 0; w <= gridx-1; w++){
							grid[w][h].advanceState();}}	
							controller.iterateNotify(); 
							refreshState();
								break;
		}
		//System.out.print("MBI");
	}