Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON: PLEASE HELP WITH PART 4! I posted full question for clarification. I need help on part 4 specifically. Part 1: Create the Control Panel

PYTHON: PLEASE HELP WITH PART 4! I posted full question for clarification. I need help on part 4 specifically.

Part 1: Create the Control Panel

Write a function named makeControl() that completes the following tasks:

Create a 300 x 250 Graphics window with a light-grey background titled Control Panel

Using Rectangles, Text objects and any other Graphics elements necessary, create the elements in the Control Panel Graphics window

The GENERATIONS title text is bold and white on a black banner

The controls are 100x30 Rectangles

START (green), PAUSE (orange), RESET (light blue), QUIT (red)

The Text objects should be drawn using the size and font as shown

Your Control Panel should match the colors, font sizes and design shown above

The makeControl() function should return all the Graphics elements necessary to interact with the Graphicswindow

Thoroughly review the Graphics Library documentation b\http://mcsp.wartburg.edu/zelle/python/graphics/graphics.pdf

Part 2: Create the Generations Grid

Write a function named makeGrid() that completes the following tasks:

Create a 400 x 400 Graphics window titled Generations Grid

Create a List of 10x10 Rectangles that fill the

Generations Grid Graphics window (40 rows/columns)

The outer-most border of Rectangles should have a black fill with a black outline

All other Rectangles have a white fill / black outline

Return the List of 10x10 Rectangles

Part 3: Bring life() to the Grid

Write a function named life() that completes the following tasks:

Each cell in the Generations Grid has an 18% chance of starting the simulation alive.

Use loops to determine the initial alive or dead status of each of the cells in the Grid.

Set the fill color for the alive cells to red and the fill color for the dead cells to white

Part 4: Create the cycle() function

Write a function named cycle() that completes the following tasks:

Use one or more loops at all eight (8) neighbors to each cell in the Generations Grid.

Determine the change to the current cells status using the following rules

Under Population: A living cell with less than two living neighbor cells should die

Neutral: A living cell with two or three living neighbor cells should stay alive

Over Population: A living cell with more than three living neighbors dies

Reproduction: A dead cell with exactly three living neighbors comes to life

Apply the change to each cells status only after fully analyzing the entire grid

Set the fill color for the alive cells to red and the fill color for the dead cells to white

Part 5: Bring the simulation together with the main() function

Write a function named main() that completes the following tasks:

Call makeControl() to create the Control Panel Graphics window.

Call makeGrid() to create the Generations Grid Graphics window.

Remember: you must assign the objects returned by a function to variables

Define a loop that repeats until a mouse click is detected on the red QUIT control in the Control Panel Graphics window.

If the simulation is not actively running, a mouse click on the green START control in the Control Panel Graphics window will start running the simulation

If the simulation is actively running, a mouse click on the orange PAUSE control in the Control Panel Graphics window will pause the simulation

A mouse click on the light-blue RESET control in the Control Panel Graphics window clears the alive/dead status of all cells by calling the life() function.

If the simulation is running when the light-blue RESET control is clicked, it continues running. If it was paused, it remains paused with the new alive/dead configuration.

Update the Text objects indicating quantity of living cells and current generation number

When the loop ends, close both Graphics windows

You must fully comment all of your Python function(s) describing your design approach as well as the variables, decisions and parameters used.

Part 4: Create the cycle() function Write a function named cycle() that completes the following tasks:

Use one or more loops at all eight (8) neighbors to each cell in the Generations Grid(10x10 grid of rectangles in 400X400 graphics window). Determine the change to the current cells status using the following rules

..... Under Population: A living cell with less than two living neighbor cells should die

..... Neutral: A living cell with two or three living neighbor cells should stay alive

..... Over Population: A living cell with more than three living neighbors dies

...... Reproduction: A dead cell with exactly three living neighbors comes to life

Apply the change to each cells status only after fully analyzing the entire grid

Set the fill color for the alive cells to red and the fill color for the dead cells to white

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Provide an argument for or against the use of virtual meetings.

Answered: 1 week ago