
The Game of Life is a computerized simulation of how a small society can
function together. In our example,
we will simulate how a group of deer will survive and try to prosper in a small
section of the woods with little space and little food.
We will use a grid to represent the space each deer is allocated.
The deer will live and die according to these rules.
This page has a simulation of the game of life on it: http://www.math.com/students/wonders/life/life.html
Instructions:
Decide how you will represent the woods and the deer. Will you use an
array? objects? An array of objects? Write out a brief description of this
phase. Explain what you used and why.
What will the initial pattern of deer in the array be? Draw it and
calculate what the next 2 generations will be. Write down all of this phase.
You will be able to use this to test your program.
You should have a UML and objects. It will likely include two methods: an interface and the game. The game will include methods to initialize the array, to count the neighbours of any cell and print out the next generation.
Use
threads to handle the animation.
Code the initial pattern and print array first.
Next, code the calculation of the next generation and put it in a loop
Finally code the opening screens, add titles, and code the closing screen.
Marking:
20% Output formatting. Forest appears nicely in the middle of the screen. Screen is cleared nicely. Opening Screen to inform the users of the name of the program and the rules the deer live or die by. Titles on of the screen. A choice of forest starting patterns.
30%
The
process of creating each population of the forest.
30% Style: Efficiency of code. Comments. Functions are used appropriately. Pre and Post conditions. Title comments. Comments before major sections of code.
20% Planning: (A) Decide how you will store the deer and the woods. What types will you use? (B) Initial pattern of the deer and the next two generations. (C) UML. **All planning is done on paper**