add cell death in wbc mode

master
shark 6 years ago
parent 48c79978f3
commit ac53887cbc

@ -32,6 +32,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
private int cycle;
private boolean cycledir = true;
Player player;
private boolean age = true;
ArrayList<Cell> cells = new ArrayList<Cell>(100000000); // Limit us at 100,000,000 cells (if we ever get there)
@ -87,8 +88,16 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
k--;
}
}
if (age && (cells.size() > 1000 || kill)) {
int y = (int) (Math.random() * (Math.abs(cells.size() - 10)) + 10);
int z = 0;
while (cells.size() > 100 && z < 10) {
cells.remove(y - z);
z ++;
}
}
//growing = true;
if(!kill) count ++; // Count how many hours have passed
if(!kill || dontkill) count ++; // Count how many hours have passed
super.repaint(); // Redraw the screen so we can see the progress
}
@ -107,6 +116,8 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
int s = 0;
int g2 = 0;
int m = 0;
int z = 0;
int x = cells.size() - 1;
for (int k = x; k >= 0; k--) // Use a loop to draw each cell
{
@ -185,6 +196,8 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
jButton3 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
setToolTipText("");
speed.setMaximum(1000);
speed.setMinimum(1);
speed.setPaintLabels(true);
@ -248,7 +261,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
.add(speed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(18, 18, 18)
.add(95, 95, 95)
.add(jButton3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

Loading…
Cancel
Save