import java.util.ArrayList; public class CellTester { private static final String SUCCESS = "PA" + "SS"; private static void later() { System.out.println("Later tasks have not been checked yet."); System.out.println("Complete the current task first, then run the tester again."); } public static void main(String[] args) { System.out.println("========================================"); System.out.println("Cell Tester"); System.out.println("========================================\n"); Cell dead = new Cell(); Cell alive = new Cell(true); if (!dead.getAlive() && alive.getAlive()) { dead.setAlive(true); if (dead.getAlive() && "1".equals(dead.toString()) && "1".equals(alive.toString()) && "0".equals(new Cell(false).toString())) { System.out.println(SUCCESS + " - Task 1: Cell basics"); } else { System.out.println("Keep working on Task 1."); System.out.println("Hint: Check setAlive() and toString()."); later(); return; } } else { System.out.println("Keep working on Task 1."); System.out.println("Hint: Check both constructors and getAlive()."); later(); return; } ArrayList neighbors = new ArrayList(); neighbors.add(new Cell(true)); neighbors.add(new Cell(true)); Cell survivor = new Cell(true); survivor.updateState(neighbors); neighbors.add(new Cell(true)); Cell born = new Cell(false); born.updateState(neighbors); neighbors.add(new Cell(true)); Cell overcrowded = new Cell(true); overcrowded.updateState(neighbors); if (survivor.getAlive() && born.getAlive() && !overcrowded.getAlive()) { System.out.println(SUCCESS + " - Task 4: Game of Life rules"); System.out.println("\nCell work complete."); } else { System.out.println("Keep working on Task 4."); System.out.println("Hint: Count living neighbors, then apply the rules for living and dead Cells separately."); later(); } } }