agents and control from agents import environment class rob_top_layer(environment)def __init__(selfmiddletimeout= locations {'mail':(- , )' ':( , )' ':( , ),'storage':( , ))"""middle is the middle layer timeout is the number of steps the middle layer goes before giving up locations is loc:pos dictionary where loc is named locationand pos is an ( ,yposition ""self middle middle self timeout timeout number of steps before the middle layer should give up self locations locations def do(self,plan)"""carry out actions actions is of the form {'visit':list_of_locationsit visits the locations in turn ""to_do plan['visit'for loc in to_doposition self locations[locarrived self middle do({'go_to':position'timeout':self timeout}self display( ,"arrived at",loc,arrivedplotting the following is used to plot the locationsthe walls and (eventuallythe movement of the robot it can either plot the movement if the robot as it is going (with the default env plotting true)or not plot it as it is going (setting env plotting falsein this case the trace can be plotted using pl plot run()agenttop py -(continued import matplotlib pyplot as plt class plot_env(object)def __init__(selfbody,top)"""sets up the plot ""self body body plt ion(plt clf(plt axes(set_aspect('equal'for wall in body env walls(( , ),( , )wall version june