Program for game of life, Simulation in MATLAB

Assignment Help:

THE GAME OF LIFE

The "Game of Life" is an example of a cellular automaton (CA) and was devised by John Conway in 1970. The "Game of Life" is played on a regular grid, with each cell initially on or off; during the game a set of rules determines the fate of these cells.

The rules are simple. For each cell:

  • If the current cell is alive (a 1 in the matrix) and it has living 2 or 3 neighbours then it survives
  • If the current cell is dead (a 0 in the matrix) and has exactly 3 living neighbours it becomes populated
  • If the current cell is alive (a 1 in the matrix) and has 0 or 1 living neighbours it dies through under-population
  • If the current cell is alive (a 1 in the matrix) and has 4 or more living neighbours it dies through overpopulation

These rules are short and easy to follow, but the game demonstrates an excellent example of simple rules demonstrating complex behaviour. You will come across examples like this in engineering all the time.

Here are four examples of why this is a good example of programming in Engineering...

 

1.      A close relation to the Game of Life is The Lattice Boltzmann technique. With this it is possible to simulate complex flows such as flow of oil through bedrock, separation of fluids and blood-flows. It's a relatively new tool for these sorts of simulations and is beginning to supplement other ways of modelling complex fluids.

2.      The matrix functions used within the Game of Life are similar to those used when modelling heat flow, fluid flow (CFD) or finite element (FE) analysis of materials.

3.      The algorithm is relatively easy to understand and very logical (it doesn't require too much engineering knowledge at this stage).

4.      It gives you good experience of structuring a programme, graphics and matrix functions.

DELIVERABLES AND MARK SCHEME

This piece of assessed work is worth 40% of the overall mark for MECH1220 so forms a significant part of the course mark. Your task is to write a Matlab program with implements the Game of Life algorithm using Matlab M-files. Your program should use a 10 x 10 grid of cells (i.e. with 10 rows and 10 columns) so that cell (i,j) corresponds to the cell in the ith row and jth column.

The following figure shows what a 4x4 grid of cells would look like:

502_THE GAME OF LIFE.png

Your program needs to have the following features to gain full marks:

1. Have a "help" facility (which the user of your program can access by typing "help" followed by your program's name in the Matlab command window) which describes accurately what the program does in English and includes a very clear description of what a user needs to do to run and use the program - very important, as the assessment marker will not have time to figure out how to use your program by themselves.

2. The program should be well commented throughout so it is clear to anyone looking at your program what each part of computer code does or is for.

3. The user of your program (the player) should have the choice of two different starting conditions:

(i) cells are initially given the following state (where grey indicates alive and white is dead)

(ii) cells are initially given the following state (where grey indicates alive and white is dead)

4. The user/player should have some choice over how many generations (iterations) the game goes on for.

5. Your program should display the generations on screen, using grey for alive cells and white for dead cells. The user/player should have some choice over how fast the generations are displayed/evolve.

6. Once the game is finished, your program should show a plot of the number of alive cells as a function of the generation/iteration number.

Required skills:

The following programming skills will be needed to complete the above computer program using MATLAB:

Loops

Decision making and Logic

Matrix operations

Plotting and image making

Keyboard input/Screen output


Related Discussions:- Program for game of life

Desktop setup and introduction to matlab, We learned how to set up our Desk...

We learned how to set up our Desktop on the CAD Lab computer. We created a Matlab shortcut on the Desktop and a CE199 folder for our work. We also learned to type some basic Matlab

Statistic using matlab, Hi, I am looking for an expert in matlab and statis...

Hi, I am looking for an expert in matlab and statistic. I would like to learn how to do correlation and PCA Analysis using my data set in Chat or via Screen sharing. Is it possible

Neural network, create neural network of 1 layer 3 neurons and logsigmoid t...

create neural network of 1 layer 3 neurons and logsigmoid transfer function

PLOT in MATLAB, I have a table which consist of 5 variables. I wish to plot...

I have a table which consist of 5 variables. I wish to plot 4variables versus i variable. how to display 4 variables on x-axis

Pulse train, define and plot the mathematical expression for the fourier se...

define and plot the mathematical expression for the fourier series epansion

Statistic using matlab., Hi, I am looking for an expert who can help me wit...

Hi, I am looking for an expert who can help me with correlation and PCA Analysis using matlab. I am interesting to learn how to do this Analysis using my data set per Chat or using

Spring-mass system, Using MATLAB, plot the response of a spring-mass system...

Using MATLAB, plot the response of a spring-mass system under a harmonic force for the following data. m=10 lb k = 2500 lb/ft F(t) = 80 cos 30 t lb x0 = 6 in ?0 = 0.15 ft/s

ANFIS , I have dataset that is divided to 70 as training and 30 percent as ...

I have dataset that is divided to 70 as training and 30 percent as testing and I need to implement ANFIS using matlab what I need : 1- ANFIS - Zero order or constant output - back

Function, Let f(x) = 2x^3-4 x+1 . Match output left number time output occu...

Let f(x) = 2x^3-4 x+1 . Match output left number time output occurs input values x -3 3. Graph calculator windows county times.

Managerial decision support Linear programing, The advertising director for...

The advertising director for Diversity Paint and Supply, a chain of four retail stores on Chicago’s North Side, is considering two media possibilities. One plan is for a series of

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd