Question: Coding question A robot starts on a point marked A on a rectangular grid of points. The starting point is always the top left point

 Coding question A robot starts on a point marked "A" on

Coding question A robot starts on a point marked "A" on a rectangular grid of points. The starting point is always the top left point on the grid. The robot can move left, right, up or down, moving from one point to the next. By moving in steps going left, right, up or down, the robot would like to reach a point marked "B", which is always the bottom right point in the grid. Sometimes, points are marked as " x ", and the robot is not allowed to visit them at all. A robot is never allowed to visit a point more than once. In how many ways can the robot move from A to B and visit all points along the way? For example, in the following grid, represented in text as A. B there is onlv one bath from A to B : In the following grid, represented in text as AB there is still only one path (we're lucky because of the two x s): However, in the grid A. . . xB there are no ways for the robot to move from A to B and visit all points that are not marked with " x ". Write a single file of Python code that can be used to count the number of paths from A to B for any given input grid. Inside this file, your code should call a function that has the following boilerplate format: def count_paths(input_string): \# parse the string input here, possibly calling other functions that you've \# written in your Python code file \# possibly call other functions that you've written in your Python code \# file to count the number of paths \# return the (integer) number of paths return number_of_paths If your code was called with input_string = 'A.. . In. . B' number_of_paths = count_paths (input_string) print (number_of_paths) the number 0 should be printed. If your code was called with input_string =A...ln...ln...ln..B number_of_paths = count_paths (input_string) print (number_of_paths) a number larger than one should be printed. We'll leave it to you to determine what it is. Your code doesn't have to run on grids larger than 1010 points, and should only make use of the Python Standard Library. Please upload your .py file here. Bonus questions Can you say anything about the complexity of the problem? How much longer do you guess it will take to obtain an answer for a 100100 grid compared to a 1010 grid? And a 110 grid compared to a 1010 grid? Can you postulate some general rules of thumb

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 Databases Questions!