Question
Python Question : Generate two very hungry turtles and one carrot. Carrot does not move. Hungry turtles search for the carrot in a 500x500 arena.
Python Question :
Generate two very hungry turtles and one carrot. Carrot does not move. Hungry turtles search for the carrot in a 500x500 arena. They use random search algorithm for their search. They have four options to move: up, down, left, right and they choose randomly one of them until they find the carrot. Use threading to keep CPU always working for the search. One turtles speed is 2 and the other one is 4. Hungry turtles will start search from opposite corners of the arena, and the carrot will be at the middle bottom of the arena. Turtles step size is 10 pixels. Some methods: isWall() : checks if turtle hits the wall or not isFound(): checks if turtle finds the carrot
Step 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