Adding comments to clarify. Write legibly. Check your code to make sure that it is computing what you want it to compute. Put a triple quote docstring in every function. Submit a handwritten hard copy next Monday at class start. Also submit a single file, quiz6_2 YourName.py, with the code for each problem and a video link showing a program run and briefly explaining your code. Make sure to announce yourself at video start. Due next Wednesday before midnight.
(10 pts) Write a boolean function, isInRect(t,xc,yc,W,H), which returns True if turtle, t, is inside or on the boundary of a rectangle of width, W, and height, H centered at xc,yc & which otherwise returns False. For this question and for the remainder of the test, assume that all rectangles have sides that are horizontal or vertical.
2. (10 pts) Write code that shows that your function from Q1 works by choosing different turtle positions relative to a rectangle with given xc,yc,W,H.
3.(20 pts) Use a while loop and use the function from Q1 as a helper function to write a function, ranWalkRects(t,x0,y0,x1,y1,W1,H1,x2,y2,W2,H2,Dz) which has turtle t start at x0,y0 outside of both rectangles execute a random walk until it is inside or on the boundary of rectangle 1 but not inside or on the boundary of rectangle 2. Assume that rectangle 1 overlaps rectangle 2 but that rectangle 1 does not lie entirely inside rectangle 2. Print out how many times the turtle moves from its starting position to the final position. Dz is the step size for the random walk. You should draw the draw the rectangles with different colors to better understand the turtles behavior. Making rectangle 1 bigger & increasing the turtle speed will decrease the run time. Run several test cases and convince yourself that your function works.
USE PYTHON





Check your code to make sure that it is computing what you want it to compute
Our Service Charter
1. Professional & Expert Writers: Homework Free only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.
2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.
3. Plagiarism-Free Papers: All papers provided by Homework Free are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.
4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Homework Free is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.
5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.
6. 24/7 Customer Support: At Homework Free, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.
Homework Free Org
Your one stop solution for all your online studies solutions. Hire some of the world's highly rated writers to handle your writing assignments. And guess what, you don't have to break the bank.
© 2020 Homework Free Org

SERVICES OFFERED


Recent Comments