Hi, i need help with this question i dont know how to do it. The answer has to b
ID: 3859871 • Letter: H
Question
Hi, i need help with this question i dont know how to do it. The answer has to be in python 3.x. Please do it in python 3.x. Thanks!
9. Implement a class Moth that models a moth flying randomly in straight lines. The moth has a position and can either move or move towards a light source. When the moth move towards the light source it moves twice as fast. If the moth touches the light source, it dies. To accomplish this, define a class LightSource with small radius around the light source that if the moth enters it dies. You must supply the following methods, as well as any other methods you think are necessary a constructor init (self, initialPosition) a method move(self, newPosition) a method moveToLight(self, lightPosition) a method getPosition(self) Create a simulation using the Turtle module that constructs two light sources anywhere on the screen and a few moths that move at random. Your the light source, as well as how far away the moth will move.Explanation / Answer
p9.py
===========================================================================
test_P9.py
=========================================================================
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.