Select Page

please check the assignment for the question.please provide it on timeCS 210
Programming Assignment 9
Life and other Automata
Assigned: April 13, 2016
Due: April 26, 2016
NOT ACCEPTED LATE
The game of Life was created by a mathematician named John H. Conway at the University of
Cambridge. It was introduced to the world by Martin Gardner in the October 1970 issue of
Scientific American in the Mathematical Games section of the magazine. Life is a game of
cellular automata. The world of Life is typically a two dimensional grid where each cell in the
grid may house a single life. The rules of Life are such that cells are born, live, or die depending
on the number of neighbors a particular cell has. Neighbors of a cell are those which surround it
(including the diagonal neighbors). So each cell has exactly 8 neighbors. The world of Life may
be either flat or round. In a flat world the edges are surrounded by cells which are unoccupied
(dead). In a round world the left side has the right side for neighbors and the top side has the
bottom side for neighbors so that the world of Life wraps around.
The rules for cell life and death are as follows:
1. If a cell has less than 2 living neighbors it is lonely and dies in the next generation.
2. If a cell has exactly 2 living neighbors it is happy and continues life in the next
generation.
3. If a cell has exactly 3 living neighbors a new cell is born in that cell or continues to
exist if it is already alive.
4. If a cell has 4 or more neighbors it is overcrowded and dies in the next generation.
For example, in Figure 1 below, the initial generation 0 moves to generation 1 in which three
cells have exactly three live neighbors so that new cells are born. Two cells are overcrowded
with 4 neighbors and die out leaving the pattern shown. In Generation 1, two cells are born but
the others die out because they have too few living neighbors. In Generation 3 all life dies out
because no one has enough living neighbors.
Generation 0
o
o o o
o o
Generation 1
Generation 2
Generation 3
o
o
o
o
o
o
o
Figure 1
In this case all life disappears in 4 generations.
Sometimes oscillating patterns occur. In fact, in larger more complicated schemes, Life
eventually evolves to some sort of stable oscillation. Figure 2 shows a simple oscillator.
Generation 0
Generation 1
o
o
o
o o o
Generation 2
Generation 3
o
o
o
o o o
Figure 2
A simple oscillator.
There are several variations on the Game of Life including Seeds, High Life, and Life Without
Death. Each of these differs from the original game only in rules for creating the next
generation.
Rules of Seeds:
All cells are off except those which have exactly two neighbors.
Rules of High Life:
A new cell is born if it has exactly three or six neighbors.
A cell survives into the next generation if it has two neighbors.
All other cells die.
Rules of Life Without Death:
These rules are the same as regular Life except that no cell ever dies.
The outline below gives the details of how to create the Game of Life. For this assignment you
will add the rules to allow the user to select one of four games: Life, Seeds, High Life, or Life
Without Death. Begin by creating the form shown in Figure 3.
Figure 3
The form and its contents. The panel should be 500 x 500.
The form should be 500 x 500 and the numeric up down block should be set to range from 1 to
1000. Locate the button and other components in a convenient arrangement.
1. Add a class to your solution called Cell. This class will represent each cell on the grid. The
code for the class is given below:
{class Cell
{private bool alive;
public Cell()
{alive = false;
}
//
public Cell(bool a)
{alive = a;
}
//
public bool Alive
{get
{return alive;
}
set
{alive = value;
}
}
}
}
2. The game has an oldWorld and a world each of which consists of an array of 100 x 100 cells.
You will need the following public and private variables:
private const int MAXX = 100;
private const int MAXY = 100;
private const int CELLSIZE = 5;
//Declare a cell array representing the world
private Cell [,] world = new Cell[MAXX, MAXY];
//Declare a cell array representing the world on the last iteration
private Cell [,] oldWorld = new Cell[MAXX, MAXY];
private int generations;
//Constructor
public Form1()
{InitializeComponent();
//Instantiate (run the constructor) the world and oldWorld arrays.
int i, j;
for(i=0;i
attachment

#### Why Choose Us

• 100% non-plagiarized Papers
• Affordable Prices
• Any Paper, Urgency, and Subject
• Will complete your papers in 6 hours
• On-time Delivery
• Money-back and Privacy guarantees
• Unlimited Amendments upon request
• Satisfaction guarantee

#### How it Works

• Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
• Fill in your paper’s requirements in the "PAPER DETAILS" section.