Java 1A Practical Class

Tick 6*


You will need to complete the optional parts described in Workbook 6 before attempting Tick 6*. In this exercise you will extend your graphical interface to the Game of Life you wrote in Workbook 6 to include an additional panel containing statistics about the configuration as it evolves. You should produce the same statistics as you computed in Tick 4*, and additionally you should include graphs showing the evolution of these statistics over the previous one hundred generations.

Example screenshot of the statistics display

Figure 1. Example screenshot of the statistics display


To complete this tick you should create a new package called uk.ac.cam.your-crsid.tick6star and implement a new class called StatisticsPanel which extends JPanel. The class should provide an implementation of a method called update with the following prototype:

public void update(World w);

You should copy the code from your Tick 6 submission into your new package and update your GuiLife program to include the StatisticsPanel by adding it to the main window for the graphical interface and specifying BorderLayout.EAST as its layout position. You will also need to modify GuiLife to call update whenever the state of the world changes.

Hints:

To complete your tick you need to prepare a jar file with the contents of all the classes you have written in this workbook and email it to ticks1a-java@cl.cam.ac.uk. Your jar file should contain:

uk/ac/cam/your-crsid/tick6star/HelloSwingWorld.java
uk/ac/cam/your-crsid/tick6star/HelloSwingWorld.class
uk/ac/cam/your-crsid/tick6star/CommandLineOptions.java  
uk/ac/cam/your-crsid/tick6star/CommandLineOptions.class 
uk/ac/cam/your-crsid/tick6star/TextLife.java            
uk/ac/cam/your-crsid/tick6star/TextLife.class           
uk/ac/cam/your-crsid/tick6star/GuiLife.java
uk/ac/cam/your-crsid/tick6star/GuiLife.class
uk/ac/cam/your-crsid/tick6star/GamePanel.java
uk/ac/cam/your-crsid/tick6star/GamePanel.class
uk/ac/cam/your-crsid/tick6star/Strings.java
uk/ac/cam/your-crsid/tick6star/Strings.class
uk/ac/cam/your-crsid/tick6star/ControlPanel.java
uk/ac/cam/your-crsid/tick6star/ControlPanel.class
uk/ac/cam/your-crsid/tick6star/PatternPanel.java
uk/ac/cam/your-crsid/tick6star/PatternPanel.class
uk/ac/cam/your-crsid/tick6star/SourcePanel.java
uk/ac/cam/your-crsid/tick6star/SourcePanel.class
uk/ac/cam/your-crsid/tick6star/WorldImpl.java
uk/ac/cam/your-crsid/tick6star/WorldImpl.class
uk/ac/cam/your-crsid/tick6star/ArrayWorld.java
uk/ac/cam/your-crsid/tick6star/ArrayWorld.class
uk/ac/cam/your-crsid/tick6star/PackedWorld.java
uk/ac/cam/your-crsid/tick6star/PackedWorld.class
uk/ac/cam/your-crsid/tick6star/AgingWorld.java
uk/ac/cam/your-crsid/tick6star/AgingWorld.class
uk/ac/cam/your-crsid/tick6star/Pattern.java
uk/ac/cam/your-crsid/tick6star/Pattern.class
uk/ac/cam/your-crsid/tick6star/PackedLong.java
uk/ac/cam/your-crsid/tick6star/PackedLong.class
uk/ac/cam/your-crsid/tick6star/PatternLoader.java
uk/ac/cam/your-crsid/tick6star/PatternLoader.class
uk/ac/cam/your-crsid/tick6star/PatternFormatException.java
uk/ac/cam/your-crsid/tick6star/PatternFormatException.class
uk/ac/cam/your-crsid/tick6star/StatisticsPanel.java
uk/ac/cam/your-crsid/tick6star/StatisticsPanel.class

Copyright Alastair R. Beresford and Andrew C. Rice 2008,2009