CS010 Introduction to Computer Science I
Term Project
Deliverable Three


Cellular Automata:
Using Object-Oriented Programming
(last updated 12/1/2005)


For the third and final deliverable, you will modify your version of Conway's Game of Life such that it uses cell-objects.  You should use the principles covered in class and in Sections 39-41 to create encapsulated classes of a cell.

Your cell must provide the following services: 
'current: returns this cell's current state
'determine-new: causes this cell to compute it's new state
'switch-to-new: causes this cell to change to its computed new state

The key problem you may immediately notice is, how will a cell know its neighbors.  You should use a new-grid definition: (vectorof (vectorof cell-object)).  Then you should provide a means for a cell object to find its neighbors, and then it can ask each of its neighbors for their respective current states.  When you create a cell-object, you will want to provide its state and its location as arguments to the constructor.  In this way, it should not be difficult for a cell-object to find its neighbors.

So, define an cell-object "interface" with a constructor called make-cell-object.  This constructor should consume three arguments, a current state [1,0], a row index and a column index.

Finally, you'll need to make minor alterations to the rest of your program that displays the grid and updates it.  The basic approach you'll probably want to use is have all of the cell-objects "determine-new" by querying their respective neighbors, and then have all the cell-objects "switch-to-new".  Then re-display the grid using "current", and finally repeat.

Your modified gcol function should accept a new-grid, (vectorof (vectorof cell-object)), and a number.  As before, it should create a canvas of the appropriate size, do whatever population or initialization is necessary from the given new-grid, and then simulate the generations of the grid according to the rules for Conway's Game of Life.


To grade this deliverable, I will review your code (including contracts, purpose statements, indentation, etc.), and then call your gcol function.   Therefore, it is important that you follow the data definitions carefully.