CSE 11 Fall 2020 PA7 & PA8 – Life of Cells
The goal of PA7 (check point) is to apply inheritance to defining the relationship among different types of cells
(cell classes). In addition to creating these cell classes, you will also be creating a PetriDish class that represents a
2D board of different types of cells.
Conway’s Game of Life is a cellular automaton that is simple to understand but has interesting properties. You
can read more about it on Wikipedia but knowledge of it is not required for this assignment.
The program we will be implementing for PAs 7 and 8 will be similar to the Game of Life. In the original game,
each cell of the board is equivalent. In our game, each cell of the board may be a different cell (in the biological
sense) and may have different behaviors.
We have abstracted out all biology, except for the term “apoptosis” which means “programmed cell death” (which
we will use to mean that a cell disappears). We will also, at various points, use the word “spawn” to mean for a
cell to come into existence.
public Cell(int currRow, int currCol, int mass)
This is the constructor for Cell .
Initialize all instance variables with the values passed in as arguments.
If an argument would make the appropriate instance variable invalid, set the appropriate instance variable to
Even though Cell is an abstract class, we need this constructor because all subclasses should use this
constructor to initialize the instance variables inherited from Cell .
public Cell(Cell otherCell)
This is the copy constructor for Cell .
Initialize all instance variables with the instance variables of the Cell object passed in as an argument.
Even though Cell is an abstract class, we need this copy constructor because all subclasses should use this
copy constructor to copy the instance variables inherited from Cell .
public void apoptosis()
This method will be called on a Cell when apoptosis happens.
Set currRow , currCol , and mass to -1 to indicate cell death.
Getters getCurrRow() , getCurrCol() , getMass()
For each getter method, return the current value of the appropriate instance variable.
public abstract boolean checkApoptosis(List<Cell> neighbors)
Given a List of Cell s, determine if this cell should initiate apoptosis or not. Return true if the condition
being checked for is satisfied and false otherwise (more details below).
This is an abstract method that each concrete subclass will implement with its own behavior.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:itcsdx