Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hover over each shape for tool tips with color information For this program you will be writing code that simulates throwing a dart randomly at

Hover over each shape for tool tips with color information
For this program you will be writing code that simulates throwing a dart randomly at the painting. To do this, you can repeatedly generate a random coordinate within the painting area and test to see which shape (if any) the dart falls into. Note that the two-dimensional plane is 800 units wide \times 500 units high and origin point (0,0) is at the top left corner, so you will be generating coordinates within this range as part of your simulation. When you are finished you should calculate the % chance of a dart hitting a particular shape.
Refer to the diagram below for the exact measurements of the painting and locations of shapes. As youre getting started, simulate just one dart toss and use the coordinate plane to determine if the dart has fallen into one of the colored regions. Begin with the red rectangle since it will be the simplest shape to work withhow can you write a statement to determine if a point falls within a rectangle?
From there, expand this logic and apply it to the other shapes. Hint: you can use the distance formula from assignment 3 again to determine if a point falls within a circular region. Once you are confident that youve designed an effective algorithm, you can scale up and place your code inside a count-controlled loop.
8
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

=+5. Choose between a direct and an indirect approach.

Answered: 1 week ago