CS 1101.py Computer Science I
Spring 2016

Computer Science Department
The Morrissey College of Arts and Sciences
Boston College

About Staff Textbook Grading Schedule Canvas
Piazza Library Resources Labs GitHub Problem Sets
Problem Set 8: Life

Assigned: Saturday April 2, 2016
Due: Tuesday April 12, 2016, midnight
Points: 10 up to 16

This is a pair project. Let a staffer know if you need help finding a partner.

Conway's Game of Life

The mathematician John Conway invented a cellular automta called the Game of Life. Although he had many other achievements, this is what he is best known for among non-mathematicians.

The game of life consists of a two-dimensional grid of cells. At any given time, every grid element is either "alive" or not. The colony takes an evolution step and a new colony develops from the old one. The single-step evolution rule is simple: the element at row, col is alive in the new generation if

  • element row, col is alive in the old generation and exactly 2 or 3 of its eight neighbors are alive, or

  • element row, col is not alive in the old generation and exactly 3 of its eight neigbors are alive.

For example, using '*' for alive and '.' for not, one evolution step would be:

+------+         +------+
|..*...|         |......|
|..*...|   ==>   |.***..|
|..*...|         |......|
+------+         +------+                
              

This problem set is an exercise in working with 2D arrays to model the evolving colony of cells. The initial configuration is given in a text file using '*' for the initial live elements. Your program should read the file into a 2D array and use the graphics library to render the colony graphically. For example, the input file one.txt should produce the repeating sequence of colonies shown in this video:

There are three versions of this problem set.
  1. 16 Points: You're on your own! Write the entire program from scratch.

  2. 13 Points: You can request code for reading the input text file into a 2D array.

  3. 10 Points: You can request code for reading the input text file into a 2D array and the code for rendering the graphics.
Created on 01-19-2016 23:10.