// Path: cas-unidimensional/src/main/java/com/ghjansen/cas/unidimensional/control/UnidimensionalSimulationController.java
// public class UnidimensionalSimulationController extends SimulationController<UnidimensionalSimulation, UnidimensionalSimulationBuilder> {
// 
//     public UnidimensionalSimulationController(UnidimensionalSimulationBuilder simulationBuilder, TaskNotification notification) throws SimulationBuilderException {
//         super(simulationBuilder, notification);
//     }
// 
// }
// 
// Path: cas-unidimensional/src/main/java/com/ghjansen/cas/unidimensional/physics/UnidimensionalCell.java
// public final class UnidimensionalCell extends Cell<UnidimensionalState, UnidimensionalTransition> {
// 
//     public UnidimensionalCell(UnidimensionalTransition transition) throws InvalidTransitionException {
//         super(transition);
//     }
// 
//     public UnidimensionalCell(UnidimensionalState state) throws InvalidStateException {
//         super(state);
//     }
// 
// }


import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.List;
import com.ghjansen.cas.unidimensional.control.UnidimensionalSimulationController;
import com.ghjansen.cas.unidimensional.physics.UnidimensionalCell;
		//create buffered image and graphics
		BufferedImage buffer = new BufferedImage(bufferWidth, bufferHeight, BufferedImage.TYPE_INT_RGB);
		Graphics2D g = buffer.createGraphics();
		
		//draw cells
		drawCells(g, simulationController, cellScale, bufferHeight);
		
		//draw grid lines
		if(showGrid && cellScale >= 3){
			drawGrid(g, cellScale, bufferWidth, bufferHeight, gridLineThickness, gridLineColour);
		}
		
		return buffer;
	}
	
	private static void drawCells(Graphics2D g, UnidimensionalSimulationController simulationController, int cellScale, int bufferHeight){
		// initial condition cells
		for(int i = 0; i < simulationController.getSimulation().getUniverse().getSpace().getInitial().size(); i++){
			UnidimensionalCell c = (UnidimensionalCell) simulationController.getSimulation().getUniverse().getSpace().getInitial().get(i);
			Color color = c.getState().getValue() == 0 ? Color.white : Color.black;
			g.setColor(color);
			g.fillRect(i * cellScale, 0, cellScale, cellScale);
			//buffer.setRGB(i, 0, color.getRGB());
			
		}
		// history cells
		for(int j = 0; j < simulationController.getSimulation().getUniverse().getSpace().getHistory().size(); j++){
			List<UnidimensionalCell> cells = (List<UnidimensionalCell>) simulationController.getSimulation().getUniverse().getSpace().getHistory().get(j);
			int y = (j+1) * cellScale;
			for(int i = 0; i < cells.size(); i++){
// Path: cas-unidimensional/src/main/java/com/ghjansen/cas/unidimensional/control/UnidimensionalSimulationController.java
// public class UnidimensionalSimulationController extends SimulationController<UnidimensionalSimulation, UnidimensionalSimulationBuilder> {
// 
//     public UnidimensionalSimulationController(UnidimensionalSimulationBuilder simulationBuilder, TaskNotification notification) throws SimulationBuilderException {
//         super(simulationBuilder, notification);
//     }
// 
// }
// 
// Path: cas-unidimensional/src/main/java/com/ghjansen/cas/unidimensional/physics/UnidimensionalCell.java
// public final class UnidimensionalCell extends Cell<UnidimensionalState, UnidimensionalTransition> {
// 
//     public UnidimensionalCell(UnidimensionalTransition transition) throws InvalidTransitionException {
//         super(transition);
//     }
// 
//     public UnidimensionalCell(UnidimensionalState state) throws InvalidStateException {
//         super(state);
//     }
// 
// }


// Path: cas-ui-desktop/src/main/java/com/ghjansen/cas/ui/desktop/swing/SimulationExportUtil.java
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.List;
import com.ghjansen.cas.unidimensional.control.UnidimensionalSimulationController;
import com.ghjansen.cas.unidimensional.physics.UnidimensionalCell;

		//create buffered image and graphics
		BufferedImage buffer = new BufferedImage(bufferWidth, bufferHeight, BufferedImage.TYPE_INT_RGB);
		Graphics2D g = buffer.createGraphics();
		
		//draw cells
		drawCells(g, simulationController, cellScale, bufferHeight);
		
		//draw grid lines
		if(showGrid && cellScale >= 3){
			drawGrid(g, cellScale, bufferWidth, bufferHeight, gridLineThickness, gridLineColour);
		}
		
		return buffer;
	}
	
	private static void drawCells(Graphics2D g, UnidimensionalSimulationController simulationController, int cellScale, int bufferHeight){
		// initial condition cells
		for(int i = 0; i < simulationController.getSimulation().getUniverse().getSpace().getInitial().size(); i++){
			UnidimensionalCell c = (UnidimensionalCell) simulationController.getSimulation().getUniverse().getSpace().getInitial().get(i);
			Color color = c.getState().getValue() == 0 ? Color.white : Color.black;
			g.setColor(color);
			g.fillRect(i * cellScale, 0, cellScale, cellScale);
			//buffer.setRGB(i, 0, color.getRGB());
			
		}
		// history cells
		for(int j = 0; j < simulationController.getSimulation().getUniverse().getSpace().getHistory().size(); j++){
			List<UnidimensionalCell> cells = (List<UnidimensionalCell>) simulationController.getSimulation().getUniverse().getSpace().getHistory().get(j);
			int y = (j+1) * cellScale;
			for(int i = 0; i < cells.size(); i++){
				UnidimensionalCell c = (UnidimensionalCell) cells.get(i);