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, 21.06.2019 18:10
For each of the following claims, determine whether they are true or false. justify your determination (show your work). if the claim is false, state the correct asymptotic relationship as o, θ, or ω. unless otherwise specified, lg is log2.(a) (b) (c) (d) (e) (f) (g) (h) (i) (j)n+1 =22n =2n =1 =ln2 n =n2 +2n−4 =33n = 2n+1 =√n = 10100 =o(n4) o(2n)θ(2n+7 ) o(1/n)θ(lg2 n) ω(n2 )θ(9n ) θ(2n lg n )o(lg n) θ(1)
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
Why do we mark tlc plates with pencil and not with pen
Answers: 2
question
Computers and Technology, 24.06.2019 08:30
Aconsumer would pay an extra they used the rent to own program to buy the computer, rather than using cash. for all of the items, is the cheapest option over the life of the contract. the most expensive overall option is to use purchase the item.
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. the program should output the average high, average low, and the highest and lowest temper- atures for the year. your program must consist of the following functions: a. function getdata: this function reads and stores data in the two- dimensional array. b. function averagehigh: this function calculates and returns the average high temperature for the year. c. function averagelow: this function calculates and returns the aver- age low temperature for the year. d. function indexhightemp: this function returns the index of the highest high temperature in the array. e. function indexlowtemp: this function retur
Answers: 3
You know the right answer?
Java ap csa
lab assignment ab23.1
life
background:
the “game of life” is a...
Questions
question
Biology, 11.01.2021 16:50
question
Chemistry, 11.01.2021 16:50
question
Mathematics, 11.01.2021 16:50
question
French, 11.01.2021 16:50
Questions on the website: 13722359