Commits

Anonymous committed fac5e39

fixed resize logic, randomizing clicked ca

Comments (0)

Files changed (1)

hackathonAlpha.html

 var width, height, colWidth, rowHeight;
 var progShow;
 var ctlXRes, ctlYRes, ctlRandomDensity, ctlFramerate;
+var evoCellData;
 
 function setup()
 {
 	ctlXRes.value = width;
 	ctlYRes.value = height;
 	
-	handleReset();
+	
 	
 	
 	caCanvas.setSize(width, height);
 	function (arrayBuffer) {
 		arrayBufferData = arrayBuffer;
 		
-		var evoCellData = EvoCell.loadEvoCellFile(arrayBuffer);
-		caSims = [];
+		evoCellData = EvoCell.loadEvoCellFile(arrayBuffer);
 		
-		for (var i = 0; i < nrSims; i++)
-			caSims[i] = new EvoCell.CASimulation(caCanvas, evoCellData, colWidth, rowHeight);
+		
+		handleReset();
 		
 	
 		timer = setInterval(fr, 1000);
 	randomDensity = parseFloat(ctlRandomDensity.value);
 	caCanvas.setSize(width, height);
 	//caSim.setSize(width, height);
+	
+	caSims = [];
+	for (var i = 0; i < nrSims; i++)
+		caSims[i] = new EvoCell.CASimulation(caCanvas, evoCellData, colWidth, rowHeight);
 }
 
 var delay=5;
 			EvoCell.mutateEvoCellRule(newRule, mutReg, mutTarget, getRandInt(20, mutTimes));
 			caSims[i].setRule(newRule);
 		}
+		else
+		{
+			caSims[i].invalidateProgram(); // TODO: this is a hack to trandomize clean this up
+		}
 	}
 	//alert(clickedCA);
 }