|
|
@ -121,7 +121,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else g.drawImage(t.getImage(), t.getX(), t.getY(), this); // otherwise, draw the cell
|
|
|
|
else g.drawImage(t.getImage(), t.getX(), t.getY(), this); // otherwise, draw the cell
|
|
|
|
|
|
|
|
|
|
|
|
if(t.currentStage == 0) {
|
|
|
|
if(t.currentStage == 0) { // record which phase the cell is in to calculate cyclin levels
|
|
|
|
g1 ++;
|
|
|
|
g1 ++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(t.currentStage == 1) {
|
|
|
|
if(t.currentStage == 1) {
|
|
|
@ -136,7 +136,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
//swingTimer.stop();
|
|
|
|
//swingTimer.stop();
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(kill && !dontkill) { // draw pacman if he needs to be drawn
|
|
|
|
if(kill && !dontkill) { // draw pacman if he needs to eat
|
|
|
|
g.setColor(Color.YELLOW);
|
|
|
|
g.setColor(Color.YELLOW);
|
|
|
|
g.fillArc(pacmanx, pacmany, 100, 100, 220 - cycle * 2, 280 + cycle * 4);
|
|
|
|
g.fillArc(pacmanx, pacmany, 100, 100, 220 - cycle * 2, 280 + cycle * 4);
|
|
|
|
if (pacmanx > -100) {
|
|
|
|
if (pacmanx > -100) {
|
|
|
@ -156,10 +156,14 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kill = false; // turn off pacman
|
|
|
|
kill = false; // turn off pacman
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g1 *= 99;
|
|
|
|
|
|
|
|
s *= 99;
|
|
|
|
|
|
|
|
g2 *= 99;
|
|
|
|
|
|
|
|
m *= 99;
|
|
|
|
jLabel1.setText("Delay: " + delay + "ms. Hours since start: " + count + ". Cell Count: " + cells.size());
|
|
|
|
jLabel1.setText("Delay: " + delay + "ms. Hours since start: " + count + ". Cell Count: " + cells.size());
|
|
|
|
jLabel2.setText("Cyclin G1: " + g1 * 99 + ". Cyclin S: " + s * 99 + ". Cyclin G2: " + g2 * 99 + ". Cyclin M: " + m * 99);
|
|
|
|
// Calculate and print cyclin levels:
|
|
|
|
|
|
|
|
jLabel2.setText("Cyclin G1: " + g1 + ". Cyclin S: " + s + ". Cyclin G2: " + g2 + ". Cyclin M: " + m + ".");
|
|
|
|
System.out.println("Cell Count: " + cells.size());
|
|
|
|
System.out.println("Cell Count: " + cells.size());
|
|
|
|
//growing = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -167,7 +171,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
/** This method is called from within the constructor to initialize the form.
|
|
|
|
/** This method is called from within the constructor to initialize the form.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* WARNING: Do NOT modify this code by hand. The content of this method is
|
|
|
|
* WARNING: Do NOT modify this code by hand. The content of this method is
|
|
|
|
* always regenerated by the Form Editor. Ignore this part! this just creates the buttons and slider
|
|
|
|
* always regenerated by the Form Editor. Ignore this part! this just creates the buttons and slider, keep scrolling
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
|
@ -286,7 +290,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
|
|
|
|
|
|
|
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton2ActionPerformed
|
|
|
|
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton2ActionPerformed
|
|
|
|
{//GEN-HEADEREND:event_jButton2ActionPerformed
|
|
|
|
{//GEN-HEADEREND:event_jButton2ActionPerformed
|
|
|
|
if(dontkill) {
|
|
|
|
if(dontkill) { // if we are currently in "stable" mode, then kill them
|
|
|
|
dontkill = false;
|
|
|
|
dontkill = false;
|
|
|
|
kill = true;
|
|
|
|
kill = true;
|
|
|
|
swingTimer.setDelay(10);
|
|
|
|
swingTimer.setDelay(10);
|
|
|
@ -300,7 +304,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(kill) { // if we press the kill button, then begin the killing
|
|
|
|
else if(kill) { // if we press the kill button while growing normally, then begin the killing
|
|
|
|
kill = false;
|
|
|
|
kill = false;
|
|
|
|
swingTimer.setDelay(delay);
|
|
|
|
swingTimer.setDelay(delay);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -321,9 +325,9 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
|
|
|
|
|
|
|
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton3ActionPerformed
|
|
|
|
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton3ActionPerformed
|
|
|
|
{//GEN-HEADEREND:event_jButton3ActionPerformed
|
|
|
|
{//GEN-HEADEREND:event_jButton3ActionPerformed
|
|
|
|
// TODO add your handling code here:
|
|
|
|
// enter stable mode
|
|
|
|
kill = true;
|
|
|
|
kill = true; // bad variable names, we're not actually killing them
|
|
|
|
dontkill = true;
|
|
|
|
dontkill = true; // remind the program NOT to kill them even though kill == true
|
|
|
|
swingTimer.setDelay(100);
|
|
|
|
swingTimer.setDelay(100);
|
|
|
|
}//GEN-LAST:event_jButton3ActionPerformed
|
|
|
|
}//GEN-LAST:event_jButton3ActionPerformed
|
|
|
|
|
|
|
|
|
|
|
|