Question: Complete algo function in following below code from lib.agents import * import numpy as npclass Wall ( Thing ) : passclass Goal ( Thing )
Complete algo function in following below code
from lib.agents import import numpy as npclass WallThing: passclass GoalThing: passfrom random import choiceclass OurAgentAgent: location direction Directiondown def moveforwardself loc: self.location loc self.location loc def turnself d: self.direction Directiond def programpercepts: global it Returns an action based on it's percepts' for p in percepts: if isinstancep Wall: printCannot move in a wall
Implement the algorithm again" it return stepsitclass MazeGraphicEnvironment: def perceptself agent: return a list of things that are in our agent's location' things self.listthingsatagentlocation for thing in self.listthingsatagentlocation: if not isinstancething OurAgent: things.appendthing return things def executeactionself agent, action: changes the state of the environment based on what the agent does. if action 'right': agent.moveforward elif action 'left': agent.moveforward elif action up: agent.moveforward elif action 'down': agent.moveforward def isdoneself: things for agent in self.agents: for thing in self.listthingsatagentlocation: things.appendthing for thing in things: if isinstancething Goal: return True return Falsemazelayout mazeinstance Maze colorGoal: 'Wall': 'OurAgent': def algomaze: implement this function using the maze from input in the maze represents the location of the agent represents the goal represents the wall represent the free space in which our agent can walk return and array of moves like this egdown "right", up "left", "left", "down" so that the agent will be at the goal use maze
