Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

----------------------------------------------------------SimpleReflexAgent.Java ----------------------------------------------------------------------------------- public class SimpleReflexAgent { public static void main(String[] args) { Environment environment; // Process command-line arguments if (args.length for(int i=0; i private static

image text in transcribed

image text in transcribed

----------------------------------------------------------SimpleReflexAgent.Java -----------------------------------------------------------------------------------

public class SimpleReflexAgent {

public static void main(String[] args) { Environment environment; // Process command-line arguments if (args.length

for(int i=0; i

private static Percept perceiveEnvironment(Environment environment) { // TODO: Implement the code to examine the environment // and returns a percept that yhe agent can reason about. } private static void performAction(AgentAction action, Environment environment) { // TODO: This method implements the agent's actuators, // i.e., it performs a given action in the environment. // HINT: Use a switch-case statement that takes advantage of the enum // REQUIREMENT: Use the following messages, exactly, as needed: // "Action: Clean" // "Action: Move Left" // "Action: Move Right" } private static AgentAction reflexVacuumAgent(Percept percept) { // TODO: Implements a Simple Reflex Agent // for the Vacuum World scenario // HINT: Refer to the slides }

}

---------------------------------------------------------------------- Hint from the slides ----------------------------------------------------------------------------

image text in transcribed

Part 2: Implementing a Simple Reflex Agent (80 points) In this part of the assignment, you are going to implement a Simple Reflex Agent that solves the Vacuum World scenario that we discussed in class. Implement the following components, making sure to follow the requirements precisely: 1. An enum, named AgentAction, with the following members: Clean, MoveRight, MoveLeft and No0p There is no need to assign specific values, the default values assigned by Java are sufficient. 2. A class named Environment, with the following characteristics Members private int agentLocation Indicates the room ID where the Agent is located Indicates whether a room is dirty. The value of an array element is set to true if the corresponding room is dir private boolean rooms[] Getters/Setters public int getAgentLocation() Retrieves the value of agentLocation public void setAgentLocation( int agentLocation Modifies the value of agentLocation public boolean[] getRooms) Retrieves the value of rooms Modifies the value of rooms public void setRooms( boolean rooms[]) Constructors public Environment int agentLocation, boolean[] rooms) Creates a new instance of the Environment class, using the values provided 3. A class named Percept, with the following characteristics Members private int location Indicates the current location of the agent. private boolean isDirty Indicates whether dirt is detected at the agent's current location Getters/Setters public int getLocation() Retrieves the value of location public void setLocation( Modifies the value of location int location) public boolean isDirty() public void setDirty( Retrieves the value of isDirty Modifies the value of isDirty boolean isDirty) 4. A class named simpleReflexAgent has been provided to you, this is where the main functionality of the Al agent resides. See Assignment Files in Canvas. The code for the main method is complete, you should not make any changes to it. Note that the code will not compile and/or work correctly until you implement all of the utility methods that are described below. Also, make sure to read all of the comments in the code private static Percept perceiveEnvironment( Environment environment) This method examines the environment and returns a percept that the agent can reason about. private static void performAction (AgentAction action, actuators, i.e., it performs a given action Environment environment) This method implements the agent's in the environment. private static AgentAction reflexVacuumAgent( Percept percept) This method implements a Simple Reflex Agent for the Vacuum World scenario function Reflex-Vacuum-Agent([location, status]) returns an action if status -Dirty return Clean else if location = A return Right else if location B return Left

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions