CS 231: Lab #3

The goal of this lab period is to get you started on the current assignment.

Documentation for Java 1.5 is located at: Java 1.5 SE API.

Documentation for Java 1.6 is located at: Java 1.6 SE API

If using a terminal is new to you, or you need a refresher, please check out the Terminal tutorial.

Tasks

  1. Create a working directory for today's lab. Copy your Entity, Landscape, and Simulation class files to it. Then start a Java file called Lab3Test.java.
  2. Download the LandscapeDisplay java class file.
  3. Write a main program that creates a 50x50 Landscape and populates it with at least 3 different types.
    • Create a LandscapeDisplay object, looking at its constructor to find the appropriate arguments. Use a grid size of 8, for now.
    • Call the update method of the LandscapeDisplay object.
  4. Edit your Simulation class from project 2 to use the LandscapeDisplay to show the simulation. Show the simulation every 20 iterations (or less). Run your simulation for no more than 180 iterations if you are looking at the simulation every 20 iterations. Use the Thread.sleep function to halt the simulation for 5 seconds each time you call the LandscapeDisplay update function.
  5. Using the cmd-shift-4 then spacebar technique, try to capture all the sequences in your simulation. These should show up as Picture #.png on the Desktop.
  6. Use the convert method to create a slide show of your simulation.

    $ convert Picture*.png -delay 50 sim.gif

    Open your sim.gif file in a browser.

Once you are comfortable with the above tasks, go on to the assignment.