Example #1
0
 /** Just to do some initialization work */
 @Override
 protected void activate() {
   super.activate();
   //		setSynchronousPainting(false);// fastest display mode
   double densityRate = 0.5;
   for (Patch patch : getPatchGrid()) {
     if (Math.random() < densityRate) {
       patch.setColor(Color.yellow);
     } else patch.setColor(Color.black);
   }
 }
 public void paintPatch(Graphics g, Patch p, int x, int y, int CellSize) {
   if (p.getVariableValue("lifeValue") == 0) g.setColor(Color.black);
   else g.setColor(Color.red);
   g.fillRect(x, y, CellSize, CellSize);
 }