CPSC 120 Principles of Computer Science Fall 2025

Topics: Cellular Automata

Due: Fri 12/12 11:59pm


Introduction

Topics showcase applications of the core concepts, in this case arrays, loops, and conditionals.

In this lab, you'll implement classic 1D and 2D cellular automata — Wolfram's elementary CA and Conway's Game of Life — as well as explore an application of 2D CAs.


Handin

To hand in your sketches:


Policies

Like labs, topics are individual assignments — what you hand in must be your own work, your own ideas, your own effort. You may get help in office hours and from Teaching Fellows, but you may not work together with a partner or in a group with others to create solutions or write code.

The policies on late work and extensions, academic integrity, and the use of AI for topics are the same as for lab 2. Review the policies there. One extension token is needed for revise-and-resubmit without an initial handin.

Also review assignments and evaluation on the Policies page for how topics factor into the final grade. The short version: topics are optional for a passing grade (C-), but achieving proficiency for at least some topics is required for a higher grade.


Preliminaries

Reference

Review the slides from 11/24 for more about cellular automata as well as specifics for how to implement the 1D and 2D CAs you'll be implementing below.


Exercises

Elementary Cellular Automata

For this exercise you will create an elementary 1D cellular automaton. (Extra credit options allow you to further explore its behavior.) To do this, follow the steps below. "As described in the slides" refers to the "Implementing Elementary CAs" slides from class on 11/24.

The rule set discussed in class and implemented above is known as Rule 90. An interesting property of this rule is that it generates the very regular Sierpinski triangle pattern when started with a single "live" cell, but it generates a pattern that stays random when started with a random initial configuration.

Game of Life

For this exercise you will implement Conway's Game of Life. To do this, follow the steps below. "As described in the slides" refers to the "Conway's Game of Life" and the "Implementing 2D CAs" slides from class on 11/24.

You are encouraged to watch the simulation a bit — can you identify some of the still life, oscillator, and spaceship patterns mentioned in class?

Fire Simulation

For this exercise you will implement the simulation of a spreading forest fire as discussed in class. To do this, follow the steps below. "As described in the slides" refers to the "Fire Simulation" slides from class on 11/24.

You should now be able to run the simulation and see how the fire spreads through the forest.

Extra Credit

You can earn extra credit by going substantially beyond the required elements. Some possibilities: