Game of Life (Finally) So, for this step, change your life function so that it calls a new function named updateNextLife( oldB, newB) in place of updateReversed, above. Then, implement the update NextLife( oldB, newB ) function so that it sets each cell in the new data according to the updating rules based on the old generation, oldB: 1. A cell that has fewer than two live neighbors dies (because of loneliness) 2. A cell that has more than 3 live neighbors dies (because of over-crowding) 3. A cell that is dead and has exactly 3 live neighbors comes to life 4. All other cells maintain their state As suggested in updateReversed, always keep all of the outer-edge cells empty. This is simply a matter of limiting your loops to an appropriate range. However, it greatly simplifies the four update rules, above, because it means that you will only update the interior cells, all of which have a full set of eight neighbors. You may want to write a helper function, countNeighbors for example, for determining the number of live neighbors for a cell in the board at a particular row and col. Hints Count neighbors only in the old generation oldB. Change only the new generation, newB. • Be sure to set every value of newB (the new data), whether or not it differs from oldB. • A cell is NOT a neighbor of itself.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
C
8
PDF assignment1.pdf
File C:/Users/sebas/Downloads/HW1 Handout/handout/assignment1.pdf
Q
of 8
X
New Tab
x +
col.
+
{B | An | (T)
1. A cell that has fewer than two live neighbors dies (because of loneliness)
2. A cell that has more than 3 live neighbors dies (because of over-crowding)
3. A cell that is dead and has exactly 3 live neighbors comes to life
4. All other cells maintain their state
V
Game of Life (Finally)
So, for this step, change your life function so that it calls a new function named updateNextLife( oldB, newB ) in place
of updateReversed, above. Then, implement the updateNextLife( oldB, newB ) function so that it sets each cell in
the new data according to the updating rules based on the old generation, oldB:
DI
As suggested in updateReversed, always keep all of the outer-edge cells empty. This is simply a matter of limiting
your loops to an appropriate range. However, it greatly simplifies the four update rules, above, because it means that you
will only update the interior cells, all of which have a full set of eight neighbors. You may want to write a helper function,
countNeighbors for example, for determining the number of live neighbors for a cell in the board at a particular row and
Hints
Count neighbors only in the old generation oldB. Change only the new generation, newB.
• Be sure to set every value of newB (the new data), whether or not it differs from oldB.
• A cell is NOT a neighbor of itself.
0.9
60
s
X
Q
0
+
Transcribed Image Text:C 8 PDF assignment1.pdf File C:/Users/sebas/Downloads/HW1 Handout/handout/assignment1.pdf Q of 8 X New Tab x + col. + {B | An | (T) 1. A cell that has fewer than two live neighbors dies (because of loneliness) 2. A cell that has more than 3 live neighbors dies (because of over-crowding) 3. A cell that is dead and has exactly 3 live neighbors comes to life 4. All other cells maintain their state V Game of Life (Finally) So, for this step, change your life function so that it calls a new function named updateNextLife( oldB, newB ) in place of updateReversed, above. Then, implement the updateNextLife( oldB, newB ) function so that it sets each cell in the new data according to the updating rules based on the old generation, oldB: DI As suggested in updateReversed, always keep all of the outer-edge cells empty. This is simply a matter of limiting your loops to an appropriate range. However, it greatly simplifies the four update rules, above, because it means that you will only update the interior cells, all of which have a full set of eight neighbors. You may want to write a helper function, countNeighbors for example, for determining the number of live neighbors for a cell in the board at a particular row and Hints Count neighbors only in the old generation oldB. Change only the new generation, newB. • Be sure to set every value of newB (the new data), whether or not it differs from oldB. • A cell is NOT a neighbor of itself. 0.9 60 s X Q 0 +
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY