CSCI 261 Programming Concepts (C++)

Fall/Winter 2011

Final Project

Right-click me and select "Save target as..." to save.

The goal of the final project is to demonstrate your understanding of all C++ programming concepts covered in this class, such that you can implement your own engineering simulations and other useful programs.

Conway's Game of Life

The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. Conway was interested in a problem presented in the 1940s by mathematician John von Neumann, who attempted to find a hypothetical machine that could build copies of itself and succeeded when he found a mathematical model for such a machine with very complicated rules on a rectangular grid.

From a theoretical point of view, it is interesting because it has the power of a universal Turing machine: that is, anything that can be computed algorithmically can be computed within Conway's Game of Life. The game made Conway instantly famous, but it also opened up a whole new field of mathematical research, the field of cellular automata.

The 'game' is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

Familiarize yourself with the game of life by playing with an online, interactive version of the game of life here.

Rules

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

The initial pattern constitutes the "seed" of the system. Each generation is created by applying the above rules simultaneously to every cell in the seed.

Application Requirements

You and your partner must implement a graphical version of the Game of Life in C++ using the OpenFrameworks toolkit. It should consist of a grid consisting of 10,000 cells (100 x 100). It should allow the user to "seed" the grid with living cells by clicking on their locations in the grid. The user should be able to press the "G" key ("G" for "go!") and the rules of the Game should commence. In addition, the user should be able to press the "R" key ("R" for "reset") and the grid should be reset (cleared), waiting for the user to seed the grid again.

An example interaction might look like the following. First, when the application starts, the empty grid should be displayed, waiting for the user to click on the grid.

When the user clicks on the cell, it becomes "alive" and appears on the grid.

The user can click on as many cells as they wish.

When the user clicks on a living cell, it should become "dead" or removed from the grid.

Once the user presses the G key, the rules of the game commence and the cells should "evolve." While the game is running, the user should not be allowed to click on any cells.

While the game is running, the user can press the R key, which resets the game to the initial state.

At this point, the user can again click on the cells in the grid and press G to start the evolution again.

Project Requirements

These are the requirements of the final project.

Choose a Teammate

This project should be worked on in pairs, and is designed to be solved in two or three sittings (aka "programming dates"). We strongly encourage you to schedule a few meetings with your partner, during which time you both sit at one machine, implementing the application. In the Extreme Programming methodology, we call this pair programming, and is an incredibly effective means of efficiently solving programming problems.

You must choose your partner (from within your own 261 section) and e-mail your instructor your partner's name by Wednesday, November 30 @ 11:59PM.

Document Your Project

You must write a brief (100 - 300 words) description of this application, describing what it is, how to play it, and the rules of the Game of Life. This documentation should be saved as a plaintext file (use Notepad) called README.txt and should be located inside your project's src folder.

This file must be called README.txt, must be located inside your src folder, and should be submitted with your code.

Implement the Application

Your project must meet the interaction requirements as described above as well as the requirements listed here. This project is graded on a 30 point scale, as described below.

Requirement Points Notes
Correct submission as a .zip of your src folder 1
Includes README.txt 1
README.txt is well-written 1
Program compiles and runs 10
Exhibits consistent, appropriate style 5
Displays a 100x100 grid 1
User can click on cells to "active" them 1
User can click on living cell to "deactivate" them 1
Evolution commences when the G key is pressed 1
Game is reset when the R key is pressed 1
Correct implementation of game rules 2
Uses at least one class 2
Appropriate use of OOP principles/design 1
All functions preceded by brief, descriptive comments 2

Keep it Simple & Ask Questions

Our intent is to leave the design and implementation of this project entirely up to you. It is very easy to over-engineer your solution; keep it simple.

In addition, be sure to start early in order to give yourself time to ask questions and experiment. (How do you add new files for classes to your project? How do you capture key presses? How do you capture mouse clicks?)

Submissions & Due Date

You should submit this project similar to previous homework assignments: create a .zip of your src folder and submit your work via blackboard.

Your work is due by midnight on Monday, December 12. No late submissions will be accepted.




The description for Conways Game of Life is quoted from Wikipedia.