Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LIFE is an organism that lives in a discrete, two-dimensional world. This world is a 2D array (r by c) of characters with each cell

image text in transcribed

image text in transcribed

image text in transcribed

LIFE is an organism that lives in a discrete, two-dimensional world. This world is a 2D array (r by c) of characters with each cell capable of holding one LIFE cell. Generations mark the passing of time. Eaclh generation brings births and deaths to the LIFE community. The births and deaths follow the following set of rules We define each cell to have eight neighbor cells. The neighbors ofa cell are the cells directly above below, to the right, to the left, diagonally above to the right and left, and diagonally below to the right and left. Be careful when checking for neighbors on the edges, e.g., a corner cell has three neighbors (see Figure 1). You can receive 20% bonus points if you count eight neighbors for all cells by making the edges of your world wrap-around (see Figure 2) . Figure l: neighbors oftwo cells in a5 by 6 world without wrap-around edges Figure 2: neighbors ofa cell in a 5 by 6 world with wrap-around edges If an occupied cell has zero or one alive neighbors, it dies of loneliness. If an occupied cell has more than three alive neighbors, it dies of overcrowding If an empty cell has exactly three alive neighbor cells, there is a birth of a new cell to replace the empty ceil. . Births and deaths are instantaneous and occur at the changes of generation. A cell dying for whatever reason may help cause birth, but a new born cell cannot resurrect a cell that is dying, nor will a cell's death prevent the death of another, say, by reducing the local population. Figures 3 and 4 are examples of static worlds, meaning they do not change at the change of generations. While figure 5 shows a self-repeating world. Figure 5: example ofa static worldFigure 4 : example of a static worldFigure 3:eample of selfrepeating world You will write a program to simulate this world. You can work on the template provided on Carmen (wherever you see /*your code here*/, replace it with your code). This template uses 2D dynamic arrays to store the world, you can also use 2D vectors, more details in Activity 1. You should first read the dimensions (r and c) of the world and create two 2D arrays with those dimensions, one original world and

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

2. What are some concerns that you need to address?

Answered: 1 week ago

Question

1. Where will you recommend that she hold the focus group?

Answered: 1 week ago

Question

3. What might you have done differently

Answered: 1 week ago