Question: For the final task we return to the assumption that the cleaner has Vacuuminator has complete knowledge of the world around it . Create a

For the final task we return to the assumption that the cleaner has Vacuuminator has complete knowledge of the world around it. Create a function optimal_vacuuminator(world). Your function should return a list of moves that will clean all the dirt in the world in the fewest moves possible. The Vacuuminator does not need to return to its starting position after cleaning the dirt.
PYTHON:To obtain any marks for this question, there must never exist a shorter path than the one your function returns for a given world. As this is a bonus question, no partial marks will be awarded.
If the Vacuuminator is unable to clean all of the dirt in the world (e.g. because there is dirt that is completely blocked by walls), it should return None.
For this task, you may assume that both the width and length of the world are less than 6 tiles. Example calls:>>> optimal_vacuuminator([['X','E','D']])
['r','r']
>>> optimal_vacuuminator([['X','D','D'],['D','E','E']])
['d','u','r','r']

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!