subject
Computers and Technology, 08.11.2019 20:31 rina62

Java ap csa
lab assignment ab23.1
life
background:
the “game of life” is a computer simulation of the life and death events of a population of bacterial
organisms. this program will determine the life, death, and survival of bacteria from one generation to
the next, assuming the starting grid of bacteria is considered generation zero. the rules for the
creation of the next generation are as follows:
1. a “neighbor” of a cell is defined as any cell touching that cell. for example, the eight blue cells
in the diagram are the neighbors of the cell in the middle.
2. every empty cell with three living neighbors will come to life in the next generation (termed a
“birth”).
3. any cell with one or zero neighbors will die of loneliness, while any cell with four or more
neighbors will die from overcrowding (termed a “death”).
4. any cell with two or three neighbors will live into the next generation (no change).
5. all births and deaths occur simultaneously.
assignment:
1. write a program that implements the game of life. the size of the grid will be a square 20 x
20.
2. the original grid of bacteria will be supplied to your program from a text file (life100.txt).
a. the first line will contain the number (n) of bacteria locations in the file.
b. what follows are n pairs of data, one pair of numbers per line.
c. the first value of each line indicates the row location while the second value on the
line indicates the column location.
d. the data file values are given as: 1 < = row < = 20 and 1 < = col < = 20.
3. after your program has initialized the grid with generation 0, your program must allow life to
proceed for 5 generations.
4. display the final results on the screen and determine the following statistical information:
a. the number of living cells in row 10.
b. the number of living cells in column 10.
c. the number of living cells in the entire board.
instructions:
1. a sample run output is given below. note, these are the correct answers if you use the
provided data file "life100.txt".

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:00
Suppose s, t, and w are strings that have already been created inside main. write a statement or statements, to be added to main, that will determine if the lengths of the three strings are in order by length, smallest to largest. that is, your code should determine if s is strictly shorter than t, and if t is strictly shorter than w. if these conditions hold your code should print (the boolean value) true. if not, your code should print false. (strictly means: no ties) example: if s, t, and w are "cat", "hats", and "skies" your code should print true - their lengths are 3-4-5; but if s, t, and w are "cats" "shirt", and "trust", then print false - their lengths are 4-5-5 enter your code in the box below
Answers: 2
question
Computers and Technology, 23.06.2019 04:20
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy.a. a fire occurs on the premises, and the building isbadly damaged.b. a burglar steals some money and securities from anunlocked safe.c. a business computer is damaged by vandals whobreak into the shop after business hours.d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm.til
Answers: 2
question
Computers and Technology, 23.06.2019 08:00
Which argument is not a valid filter? does not equal this quarter filter by cell color all of these are valid filter arguments.
Answers: 2
question
Computers and Technology, 24.06.2019 11:20
Print "censored" if userinput contains the word "darn", else print userinput. end with newline. ex: if userinput is "that darn cat.", then output is: censoredex: if userinput is "dang, that was scary! ", then output is: dang, that was scary! note: if the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.#include #include using namespace std; int main() {string userinput; getline(cin, userinput); int ispresent = userinput.find("darn"); if (ispresent > 0){cout < < "censored" < < endl; /* your solution goes here */return 0; }
Answers: 3
You know the right answer?
Java ap csa
lab assignment ab23.1
life
background:
the “game of life” is a...
Questions
question
Mathematics, 27.03.2020 17:51
question
Mathematics, 27.03.2020 17:51
Questions on the website: 13722367