subject

You will write a program that generates random drawings that can be drawn using the shape painter.

The shape painter consumes a drawing file where each line corresponds to a rectangle or circle shape that is part of the drawing. A line in a drawing file has the following structures:

Circle; 80, 72; 15; 32, 208, 86
Rectangle; 145, 106; 421, 274; 32, 208, 205
The first line would draw a circle with a center point at coordinate (80, 72), a radius of 15, and a fill color with 32 for the red intensity, 208 for the green intensity, and 86 for the blue intensity. The second line would draw a rectangle with an upper left corner at coordinate (145, 106), a lower right corner at coordinate (421, 274), and a fill color with 32 for the red intensity, 208 for the green intensity, and 205 for the blue intensity.

Your goal is to create a program that generates drawing files by randomly creating these shape lines. A user should input, in this order

the name of the file to write the shape lines out to
the number of shapes to generate and write to the file as lines.
For each line to be written into the drawing output file, your program should randomly choose:

the shape type
the corresponding Point coordinates: currently the shape painter assumes the window size is 500 pixels wide by 500 pixels tall so you should only generate Point coordinate values that will remain within those bounds
a fill color: you should not randomly generate each intensity color for the full range of 0 to 255. In order to make your drawings more attractive, you should use smaller ranges of intensity values, and those smaller ranges are up to you. For example, you could randomly select blue intensity values in the range 192 to 255.
any other necessary values (e. g., the radius of a Circle).
An example interaction:

Enter the drawing file name to create: d3.txt
Enter the number of shapes to make: 30
This will write 30 shape lines to the file `d3.txt`. A sampling of those lines:

Rectangle; 127, 143; 318, 332; 32, 208, 253
Circle; 302, 323; 15; 32, 208, 255
Circle; 458, 253; 47; 32, 208, 129
Circle; 80, 72; 15; 32, 208, 86
Rectangle; 145, 106; 421, 274; 32, 208, 205
The user should then be able to open that file with the included `shape_painter. py` program and see what the drawing looks like.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
Consider how gaming consoles initially relied on joysticks and joypads and then made the switch to modern gaming controls, which include analog sticks, buttons and switches, touch controls, accelerometers, motion controls, etc. name at least two kinds of gaming experiences that are possible with these new control devices but were not possible on original joysticks. explain how new technologies made this newer game style possible.
Answers: 1
question
Computers and Technology, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
question
Computers and Technology, 24.06.2019 09:00
Technician a says that a new replacement part is always good. technician b says that sometimes recent repair work will be the cause of a complaint. who is correct? a. both technicians a and b b. technician a c. technician b d. neither technician a nor b
Answers: 3
question
Computers and Technology, 25.06.2019 06:00
Shaniya has misspelled a scientific name in her biology report. she needs to correct it, but she has no access to a computer. she plans to use the word app on her phone without an office 365 subscription. can shaniya correct her mistake? why or why not? yes, she can navigate the window and do simple editing. yes, she can use this application for free and navigate the window. no, her document is “read-only,” so she cannot navigate the window. no, her application has limited features and she cannot access the documen
Answers: 1
You know the right answer?
You will write a program that generates random drawings that can be drawn using the shape painter.
Questions
question
Mathematics, 24.08.2019 11:00
question
Mathematics, 24.08.2019 11:00
Questions on the website: 13722362