add cell death after many splits

master
ThirstyShark 6 years ago
parent bbb3ae4870
commit a9b8121c4a

@ -1,4 +1,4 @@
#Fri, 08 Feb 2019 09:19:53 -0600 #Fri, 08 Feb 2019 09:36:47 -0600
C\:\\Users\\cd109\\Desktop\\temp2\\CancerGrowth= C\:\\Users\\cd109\\Desktop\\temp2\\CancerGrowth=

@ -28,6 +28,7 @@ public class Cell extends Object
private static final BufferedImage p2; private static final BufferedImage p2;
private static final BufferedImage p3; private static final BufferedImage p3;
private static final BufferedImage p4; private static final BufferedImage p4;
int splits = 0;
static static
{ {
@ -168,6 +169,7 @@ public class Cell extends Object
{ {
if (currentStage == 3) if (currentStage == 3)
{ {
splits ++;
// If we need to split this code runs // If we need to split this code runs
int width = (int) (-50 + Math.random() * 101); //randomize splitting direction int width = (int) (-50 + Math.random() * 101); //randomize splitting direction
int height = (int) (-50 + Math.random() * 101); int height = (int) (-50 + Math.random() * 101);

@ -80,6 +80,10 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
if (t != rec) { if (t != rec) {
cells.add(rec); // If performing the simulation results in a new daughter cell, add it to the list cells.add(rec); // If performing the simulation results in a new daughter cell, add it to the list
} }
if(t.splits > 10) { // IF the cels splits too much, it dies
cells.remove(t);
k--;
}
} }
//growing = true; //growing = true;
if(!kill) count ++; // Count how many hours have passed if(!kill) count ++; // Count how many hours have passed

Loading…
Cancel
Save