Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Python) I having trouble with writing the setNextGenList. Any tips would be great 1. Write the definition of the function displaySubMenu that displays the following

(Python) I having trouble with writing the setNextGenList. Any tips would be great

1. Write the definition of the function displaySubMenu that displays the following menu; this function doesn't collect the user's input; only display the following menu.: [S]top Press 'S' to stop.

2. Write the definition of the function setNextGenList that creates a pattern of next generation (tempGen) based on the current generation (currentGen); modify the tempGen based on the currentGen by applying the rules of Game of Life.

Conway's Game of Life Rules:

- The neighbors of a given cell are the cells that touch it vertically, horizontally, or diagonally. - Any live cell with fewer than two live neighbours dies, as if caused by underpopulation. - Any live cell with two or three live neighbours lives on to the next generation. - Any live cell with more than three live neighbours dies, as if by overpopulation. - Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

3. Create a loop to generate and next pattern automatically. When executing your program, the following should happen: a. Print the menu using the displayMenu function. b. Initialize the tempGen using the setZeroList function. c. Set the U pattern in the tempGen using the setInitialPatternList function. d. Copy the tempGen to the currentGen using the copyList function. e. Print the currentGen using the displayList function. f. When the user presses P, loop the following steps: 1). Print the menu using the displaySubMenu function. 2). Generate a next pattern using the setNextGenList function. 3). Copy the tempGen to the currentGen using the copyList function. 4). Print the currentGen using the displayList function. g. When the user presses S, it will terminate the loop in step f, and reset the screen to the 'U' pattern. h. When the user presses Q, it will terminate the program.

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

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago