Falling Sand

Author: Dave Feinberg
(feinbergd of columbusacademy.org)

Here is the actual assignment description and starter code (featuring 2-D arrays), as given to students.

Here is an alternate version of the assignment for teachers who have not yet covered arrays.


Summary The Falling Sand assignment lets users paint with particles--stationary metal particles, falling sand, flowing water, and whatever students can think up! Students have introduced acid, clouds, fire, gas, lightning, plants, seeds, and much more! Students are essentially inventing their own interactive 2-D cellular automata.
Topics 2-D Arrays
Audience Mid/late CS1 or early CS2
Difficulty Fairly easy, with most students completing the core of the assignment in 2 - 3 hours.
Strengths The assignment is graphical and interactive. It is easy to complete and easy to extend. It is open-ended. The assignment shows one way that computers can be used to simulate scientific phenomena. It spurs conversation and exploration of topics across science curriculum. Students love it!
Weaknesses As currently implemented, students may need to tweak the dimensions of the grid and the redraw frequency for the software to run at an appropriate speed on their particular computer.
Dependencies In its current form, it depends on Java, 2-D arrays, using objects (very briefly) and completing a class that has already been set up for students. The assignment was designed to give students practice with 2-D arrays, but a version without array syntax is also available for teachers who have not covered 2-D arrays yet.
Variants With infinite possibilities, students will easily come up with their own variants!

My Experience

This assignment has been a huge success for me, with the majority of my students indicating they "loved" the assignment. The highlight for me has been the kinds of conversations the assignment has sparked, with students asking each other things like

This assignment has appealed to a wide range of students--even those who had already earned credit for the course!

The big takeaway for me is that students respond very favorably to this kind of open-ended assignment. And it's so neat to hear students driving a discussion about science in a CS classroom.


You can read more about "falling sand games" (sometimes called "powder games") on Wikipedia. A quick web search turns up a number of implementations of such particle simulations. Here is one you can try in your browser.


I give 90% to anyone who completed the core assignment (metal, sand, and water) on time. I award an additional 2% for each essentially new behavior added.