Example input
Cleaning the path
There was a storm last night and some leaves were blown on the gravel path.
Have Reeborg collect all the leaves, and toss() them in the compost bin. Make sure that Reeborg ends at home!
What you need to know
The functions move(), turn_left(), take(), and toss().
How to use the test object_here(), carries_object() and either front_is_clear() or wall_in_front().
How to use a while loop and an if statement.
Ideally, you should define your own functions to make your program easier to understand.
Example output
Let's break down the task into steps, create a flowchart for these steps, and then translate these steps into Python comments.
Here's how we could approach this task:
Start: Reeborg is at the starting point.
Move along the path: Reeborg moves along the path until it encounters a leaf or a wall.
Check for a leaf: If Reeborg encounters a leaf, it should take() it.
Check for a wall: If Reeborg encounters a wall, it should turn left.
Check if Reeborg is carrying an object: If Reeborg carries an object, it should continue until it finds the compost bin.
Toss the leaf: If Reeborg is at the compost bin, it should toss() the leaf into the bin.
Check if Reeborg is at home: If Reeborg is at home and not carrying any object, the task is complete.
If Reeborg is not at home or is still carrying a leaf, it should continue from Step 2.
Flowchart: https://imgur.com/252N354
Comments: https://imgur.com/eiWdaYb