06-Assignment-1-Life

# 06-Assignment-1-Life - CS106X Autumn 2010 Handout 06...

This preview shows pages 1–3. Sign up to view the full content.

CS106X Handout 06 Autumn 2010 September 22 nd , 2010 Assignment 1: The Game Of Life A brilliant assignment from Julie Zelenski. Let the fun begin! Your first real assignment centers on the use of a two-dimensional grid as a data structure in a cellular simulation. It will give you practice with control structures, functions, templates, and even a bit of string and file processing. More importantly, the program will exercise your ability to decompose a large problem into manageable bits. What’s especially nice about this program is that you can construct a beautiful and elegant solution if you take the time to think through a good design. It can be as lovely to look at the code as it is to watch it run. Checkpoint Due: Monday, September 27 th , at 5:00 p.m. Full Project Due: Wednesday, September 29 th at 5:00 p.m. The Problem Your mission is to implement a hyped-up version of the game of Life, originally conceived by the British mathematician J.H. Conway in 1970 and popularized by Martin Gardner in his Scientific American column. The game is a simulation that models the life cycle of bacteria. Given an initial pattern, the game simulates the birth and death of future generations using simple rules. Think of it as a Lava Lamp for mathematicians. (Yeah, mathematicians need to get out a little more often – but that's not important right now. ..) The game is played on a two-dimensional grid. Each grid location is either empty or occupied by a single cell (X). A location's neighbors are any cells in the surrounding eight adjacent locations. In the following example, the shaded middle location has three "live" neighbors: X X X

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 The Checkpoint This assignment is likely bigger and more complicated than anything you built during your time in CS106A. To ensure that you’re not blindsided by the sheer amount of work, we’re asking that you submit a partially working program—one that implements most of the program flow—two full days before the formal due date. For the Monday checkpoint, you should submit a partially working program that: prints out all of the text that gets printed to the console, as illustrated by the sample application, prompts the user to either generate a random grid, or to initialize a grid based on the contents of a data file, populates a grid using either randomization or by reading in the contents of the named file, and draws the initial state of the grid to the graphics window, waiting for a mouse click to clear the screen, and start over. In a nutshell, the checkpoint implementation the setup and all of the plumbing for the Game of Life, without playing the actual game. We won’t be assigning a formal grade to the checkpoint submission, but your section leader—even if you haven’t met him or her by the time you submit—will email you if he or she detects any major no-nos with your partial implementation. We’re strongly recommending you submit this checkpoint by Monday at 5:00 p.m. so that you gain a
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/13/2011 for the course CS 106X taught by Professor Cain,g during the Fall '08 term at Stanford.

### Page1 / 8

06-Assignment-1-Life - CS106X Autumn 2010 Handout 06...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online