Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a two - dimensional Numpy array that looks like the following... o Accomplish this by 1 st creating a 2 - dimentional Numpy array

Create a two-dimensional Numpy array that looks like the following...
o Accomplish this by 1st creating a 2-dimentional Numpy array of size 5x5 which is
prefilled with zeros. (Note this can be done in one line of code.)Use appropriate slicing methods to add the individuals to the grid. The upper corner will
require one line of code and the block of 1s in the middle of grid can be accomplished
in one line of code.
Display the starting array to the user through a print statement.
Create another numpy array that will represent the previous generation. At the beginning,
this array will simply be an exact copy of the starting array.
Create a for loop that will spawn the next 5 generations of the boards.
Within each loop iteration (generation cycle)...
o You will basically have 3 boards...
1. The board previous to the starting board for the cycle (previous board)
2. The board used at the beginning of the cycle (starting board)
3. The board generated in the cycle based on the starting board (new board)
o Based on the contents of the array within the starting board for the current generation,
determine the contents of array for the next generation. Use the rules described in the
project background section to determine the contents of the next generation.
1. Use the numpy sum function to determine the number of neighbors. An
important thing to consider is that you can use slicing to get the block of cells
and then use sum to determine the total population of the block. If you
subtract the value of the cell being evaluated, you will have the population of
the neighborhood.
o Print off the 3 boards (previous, starting, next gen)
o After determining the next generation board print out how many cells in the next
generation board are different from the starting board and how many cells in the next
generation board are different from the previous board.
1. NOTE In this step you are determining which cells are different. You are not
determining if the number of lives in the board is different. The reason for this
is because if the cells in the next generation board are the same as the starting
board, youll basically have an infinite cycle where the spawned boards are not
any different than the starting board. Additionally, if the next generation board
is a mirror copy of the previous board, youll have a loop where the boards will
just oscillate back and forth.
Run the application by clicking the Start button with the green arrow. Ensure the program runs
as expected. If the program does not run as expected, make appropriate coding changes and
retest.

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

Students also viewed these Databases questions

Question

5. Structure your speech to make it easy to listen to

Answered: 1 week ago

Question

1. Describe the goals of informative speaking

Answered: 1 week ago