Purpose: The purpose of this assignment is to program a shared memory parallel program problem that uses synchronized computation and OpenMP in its solution.

Guidelines:

This assignment is to be done on your own. You may not work with other students in the class. You may use materials from the texts and outside readings. Looking at pseudocode solutions from textbooks is OK. However, it is cheating to look up the specific solution to this problem on the web or another resource. You may use any code given in the as a starting point. You may also want to visit the simulations at the Shodor Foundation, for fun.

Program Specifications:

In the lecture, I described cellular automata, and stated that the most famous cellular automata is the "Game of Life" devised by John Horton Conway, a Cambridge mathematician.

Option 1: the Game of Life

For the Game of Life program, I would like for you to write an OpenMP program that simulates a two-dimensional cellular automaton. Use the rules from the Game of Life, but try to write your program in such a way that you could change the rules and your program would still work. Although this is quite inefficient from an OpenMP perspective, I would like for your program to output the pattern of the board after every generation. It's more interesting this way!

One way to write your program is to have the input for your program come from a file. Several sample files are provided for you to test the Game of Life program:

In these files line 1 of the file contains the number of rows and columns in the data array, line 2 of the file contain an integer which is the number of generations. You may use this number directly, or you may allow a command line parameter to override this value. The next N lines of the file contain the data array. A '0' represents a dead cell, and a '1' represents a living cell.

Option 2: Fire!

For the Fire! program, I would like for you to write an OpenMP program that simulates a two-dimensional cellular automaton. You may use rules that are found in the simulation of Fire at the Shodor Foundation, or you may make up your own. Include at the top of the program a set of comments that describes in detail the rules that your simulation will use. As with the Game of Life, you may have your initial data come from a file, or you may prefer to use a command line parameter to input the coordinate of the tree that will catch on fire first, and the probability that a neighbor tree will catch on fire.

Option 3: Sharks and Fish

For the Sharks and Fish program, I would like for you to write an OpenMP program that simulates a two-dimensional cellular automaton. I will provide the rule in a separate document. Include at the top of the program a set of comments that describes in detail the rules that your simulation will use. As with the Game of Life, you may have your initial data come from a file, or you may prefer to initialize the grid using a random set of sharks and fish. If you use an input data file be sure that you provide a sample set of data for testing your program. Be sure that your comments section of your program describes how to run your program, and also provide a message if the parameters are not correctly entered.

Option 4: Foxes and Rabbits

For the Foxes and Rabbits program, I would like for you to write an OpenMP program that simulates a two-dimensional cellular automaton. I will provide the rules in a separate document. Include at the top of the program a set of comments that describes in detail the rules that your simulation will use. As with the Game of Life, you may have your initial data come from a file, or you may prefer to initialize the grid using a random set of foxes, rabbits, and grass. If you use an input data file be sure that you provide a sample set of data for testing your program. Be sure that your comments section of your program describes how to run your program, and also provide a message if the parameters are not correctly entered.

Option Selection: The options are not equally difficult and there is much opportunity for extra functionality. Extra credit will be given for selection of a more difficult options and/or for additional functionality in your program. The Game of Life is the simplest and is worth at most 95% credit.

What you turn in:

  1. A demonstration of your program and your source code.

Enjoy!