Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN PYTHON IN PYTHON IN PYTHON In this section, you will investigate the problem of navigation on a two-dimensional grid with obstacles. The goal is

IN PYTHON

IN PYTHON

IN PYTHON

image text in transcribed

In this section, you will investigate the problem of navigation on a two-dimensional grid with obstacles. The goal is to produce the shortest path between a provided pair of points, taking care to maneuver around the obstacles as needed. Path length is measured in Euclidean distance. Valid directions of movement include up, down, left, right, up-left, up-right, down-left, and down-right. Your task is to write a function find_path(start, goal, scene) which returns the shortest path from the start point to the goal point that avoids traveling through the obstacles in the grid. For this problem, points will be represented as two-element tuples of the form (row, column), and scenes will be represented as two-dimensional lists of Boolean values, with False values corresponding empty spaces and True values corresponding to obstacles. Your output should be the list of points in the path, and should explicitly include both the start point and the goal point. Your implementation should consist of an A* search using the straight-line Euclidean distance heuristic. If multiple optimal solutions exist, any of them may be returned. If no optimal solutions exist, or if the start point or goal point lies on an obstacle, you should return the sentinal value None >scene[[False, False, False], [False, True False], [False, False, False]] >>> scene = [[False, True, False], [False, True, False], [False, True, False]] >>> find_path((e, ) (2, 1), scene) >>> print find_path((e, e), (e, 2), scene) None

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

More Books

Students also viewed these Databases questions

Question

2 What supply is and what affects it.

Answered: 1 week ago