Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5.14 Roboticist You are a Roboticist working on an algorithm to let a new Roomba cleaning robot know which places are dirty in it's environment

image text in transcribedimage text in transcribedimage text in transcribed

5.14 Roboticist You are a Roboticist working on an algorithm to let a new Roomba cleaning robot know which places are dirty in it's environment The first number is the number of lists making up the environment. The Roomba's environment is simplified as a string of inputs, with indicating somewhere clean, and'd' indicating somewhere dirty and t indicating the current position of the roomba as follows 2 rdcdc dcccd The Roomba can take the following actions right left down clean The directions are moves the Roomba can take in the specified direction, and clean is the action the Roomba takes to clean a dirt spot. Create a function called ToClean(environ) that takes a nested list of strings as inputs and returns a list of strings where the list is the order of actions the robot needs to take to clean the environment. You only need to have the robot clean the dirty spaces in the order they appear in the environ from left to right up to down For example, if the input is: 2 rdcdc dcccd Then the output would be ['right', 'clean', 'right','right', 'clean', 'left', 'left', 'left', 'down', 'clean', 'right', right', 'right', 'right', 'clean' Hint: The Roomba always starts in the upper left corner HINT: Get the locations of the dirty spaces first, then loop through those to decide the Roomba's actions HINT : Use the location of the Roomba in relation to the dirty space locations to decide the actions HINT: You should not modify the input lists to get the actions. Simply make variables to reference the locations in the input lists. LAB ACTIVITY 5.14.1: Roboticist 0/3 main.py Load default template... 1 def create_listO 2 inp str-input) lista ist(inp str) return 1ista 4 um 1stint(input)) for i in range(num_1ist): name-V' +str(1) locals()['v+str(i)]-i 11 print(name)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

b. Why were these values considered important?

Answered: 1 week ago