Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python: I have a perfectly square 30m x 30m backyard. I bought 10 trees and I want to plant them in totally random places so
Python: I have a perfectly square 30m x 30m backyard. I bought 10 trees and I want to plant them in totally random places so that it looks more natural. Im concerned that if we plant any two trees within 3m of each other, then they will have a hard time growing. Create a program that makes a 30x30 2D list, and randomly assigns positions for 10 trees. You must keep re-doing the process until no two trees are within 3 meters of each other. [50 marks] Note: use pythagorean theorem to calculate distance.
For example, here is an invalid backyard This backyard is invalid because the two circled trees are 2.82 meters apart. One treba at position (1,1) and the other is at (3, 3). The distance is 1-V2) + (--(8 - 1)* + (3 - 17 - 2+2 V82.82 meters Here is a valid backyardStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started