Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use csplot to make Conway's game of lif. needs the following functions to count for full points. So, for this step, change your life function

image text in transcribedimage text in transcribeduse csplot to make Conway's game of lif. needs the following functions to count for full points.

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: 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. Once your Game of Life is working, look for some of the other common patterns, e.g., other statically stable forms ("rocks"), as well as oscillators ("plants") and others that will move across the screen, known as gliders ("animals/birds"). Rubric 10% Create an empty 2d board 10% Able to properly display the board (using csplot) 10% update1() 10% update2() 10% updateReversed() 20% Successful loop with user input 30% updateNextLife () with 3 different examples What to turn in: - life.py

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

Th ey told me Id have to write a lett er. Whos got time for that?

Answered: 1 week ago