Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will be submitting two source files: assn10.py and pattern.py. You will also submit your software development plan: plan.txt You are going to create a

You will be submitting two source files: assn10.py and pattern.py. You will also submit your software development plan: plan.txt

You are going to create a program that draws cool patterns. The user will have three modes to choose from:

Rectangle Pattern - A circular pattern created by drawing multiple rectangles

Circle Pattern - A circular pattern created by drawing multiple circles

Super Pattern - A random selection of some number of Rectangle and Circle Patterns

Code

assn10.py - Use the starter file given and only fill in the appropriate areas. Do not modify any code that is there already, only add to it. This file will help you with defining the functions in pattern.py.

pattern.py - You must define the following functions

reset() - Erase all of the patterns and start over

setup()

Configure turtle to draw quickly

Configure turtle to have a window of 1000 x 800

drawRectanglePattern()

Use appropriate parameters

It should call drawRectangle()

drawRectangle()

Use appropriate parameters

Should draw a SINGLE rectangle

drawCirclePattern()

Use appropriate parameters

drawSuperPattern()

Use appropriate parameters

Randomly draw Rectangle and Circle patterns. Each pattern should based on random values.

Use reasonable random values (some can be negative) so patterns are drawn on the screen

setRandomColor()

Do not use any parameters

Set turtle to draw in a random color

Use at least 3 colors

done()

Called when user quits

Keeps the turtle window open

Make sure to read the rubric to see the additional requirements.

Drawing Rectangle Pattern

The Rectangle Pattern has 6 parts to it

Center position - This is the x, y center point of the circular pattern that is drawn

Offset - This is the distance from the center position to the starting corner of each rectangle. It can be a positive or negative number

Height - The height of a rectangle

Width - The width of a rectangle

Count - The number of rectangles to draw within the 360 degree pattern.

Rotation - The number of degrees each rectangle is rotated in relation to the line from the Center Position to the starting corner of the rectangle

Each individual rectangle should be a new random color.

Drawing Circle Pattern

The Circle Pattern has 4 parts to it

Center position - This is the x, y center point of the circular pattern that is drawn

Offset - This is the distance from the center position to starting drawing point of each circle. It can be a positive or negative number. Note that the center point of each circle should be 'radius + offset' distance from the Center Position of the pattern.

Radius - The radius of the circle

Count - The number of circles to draw within the 360 degree pattern.

Each individual circle should be a new random color.

Rubric

3 pts: SoftwareDevelopment Lifecycle Plan (see assn #6 for description)

3 pts: Get input properly from users. You may assume the users give valid input

3 pts: main() is the only function defined in assn9.py, which also calls main()

Use the starter code properly

5 pts: Create a module called pattern.py.

This contains all of the functions associated with drawing the patterns

5 pts: Proper implementation and usage of reset()

5 pts: Proper implementation and usage of setup()

20 pts: Proper implementation and usage of drawRectanglePattern() as defined above

location, offset, width, height, count, and rotation are all used and drawn properly

10 pts: Proper implementation and usage of drawRectangle() as defined above

20 pts: Proper implementation and usage of drawCirclePattern() as defined above

location, offset, radius, and count are all used and drawn properly

10 pts: Proper implementation and usage of drawSuperPattern() as defined above

8 pts: Proper implementation and usage of setRandomColor() as defined above

5 pts: Proper implementation and usage of done() as defined above

3 pts: Follow proper coding conventions

Below is the assn10.py file given

'''

This is the starter file. Only fill in the areas indicated.

Do not modify existing code.

Replace this file header with the normal file header (name, etc)

'''

#### Add Import Statement(s) as needed ####

#### End Add Import Statement(s) ####

def main():

# Setup pattern

pattern.setup()

# Play again loop

playAgain = True

while playAgain:

# Present a menu to the user

# Let them select 'Super' mode or 'Single' mode

print("Choose a mode")

print("1) Rectangle Pattern")

print("2) Circle Pattern")

print("3) Super Pattern")

mode = eval(input("Which mode do you want to play? 1, 2 or 3: "))

# If they choose 'Rectangle Patterns'

if mode == 1:

#### Add Input Statement(s) as needed ####

#### End Add Inputs Statement(s) ####

# Draw the rectangle pattern

pattern.drawRectanglePattern(centerX, centerY, offset, width,

height, count, rotation)

# If they choose 'Circle Patterns'

elif mode == 2:

#### Add Input Statement(s) as needed ####

#### End Add Inputs Statement(s) ####

# Draw the circle pattern

pattern.drawCirclePattern(centerX, centerY, offset, radius,

count)

# If they choose 'Super Patterns'

elif mode == 3:

#### Add Input Statement(s) as needed ####

#### End Add Inputs Statement(s) ####

if num == "":

pattern.drawSuperPattern()

else:

pattern.drawSuperPattern(num)

# Play again?

print("Do you want to play again?")

print("1) Yes, and keep drawings")

print("2) Yes, and clear drawings")

print("3) No, I am all done")

response = eval(input("Choose 1, 2, or 3: "))

#### Add Statement(s) to clear drawings and play again ####

#### End Add Inputs Statement(s) ####

# print a message saying thank you

print("Thanks for playing!")

pattern.done()

main()

solution in python.

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