Question
Can you send me the original code which I can Copy and paste, please. Thank you so much Plot Grid In this assignment, you will
Can you send me the original code which I can Copy and paste, please. Thank you so much
Plot Grid
In this assignment, you will write a function called plot_grid() which will take a grid, an iterable of open nodes, and an iterable of closed nodes. The grid will be of the format described in the first assignment of HW5. This function should print out a representation of the graph with a pipe (|, shift+\) on each side of each cell (only 1 between each cell). If the cell is in the closed set, print an x in it, if it is an open cell, print an o (lowercase letter o), if it is a wall, print w, and otherwise, print an underscore (_). Each row of the grid should be printed on its own line
Expected behavior:
graph = [
[0, 0, 1, 0, 0],
[0, 1, 1, 0, 0],
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[0, 0, 0, 1, 0],
]
closed = {
(0, 0),
(0, 1),
(1, 0),
(0, 2),
(0, 3),
}
open_list = [
(1, 2), (0, 4),
]
plot_grid(graph, open_list, closed)
|x|x|w|_|_|
|x|w|w|_|_|
|x|o|_|_|_|
|x|w|w|w|_|
|o|_|_|w|_|
#use this below
def plot_grid(graph, open_nodes, closed_nodes):
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started