Question
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
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 meet the specifications precisely:
*****Provided SimpleReflexAgent Code*****
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 int agentLocation; private boolean rooms[]; } 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
}
The only two areas I am struggling in are the Environment and the AgentAction, I have created the reflexVacuumAgent already.
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 meet the specifications precisely: 1. Implement an enum, named AgentAction, with the following members: Clean, MoveRight, MoveLeft and Noop 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. private boolean rooms [] Indicates whether a room is dirty. The value of an array element is set to true if the corresponding room is dirty. Getters/Setters public int getAgentLocation() Retrieves the value of agentLocation Modifies the value of agentLocation public void setAgent Location int agent Location) public boolean[] getRooms() Retrieves the value of rooms Modifies the value of rooms public void setRooms boolean rooms[]) public Environment int agent Location, boolean[] rooms) Constructors Creates a new instance of the Environment class, using the values provided. 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 Retrieves the value of location public int getLocation() Modifies the value of location public void setLocation int location) public boolean isDirty() Retrieves the value of isDirty Modifies the value of isDirty public void setDirty 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, Environment environment) This method implements the agent's actuators, i.e., it performs a given action in the environment. private static AgentAction reflexVacuumAgent Percept percept) This method implements a Simple Reflex Agent for the Vacuum World scenario 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 meet the specifications precisely: 1. Implement an enum, named AgentAction, with the following members: Clean, MoveRight, MoveLeft and Noop 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. private boolean rooms [] Indicates whether a room is dirty. The value of an array element is set to true if the corresponding room is dirty. Getters/Setters public int getAgentLocation() Retrieves the value of agentLocation Modifies the value of agentLocation public void setAgent Location int agent Location) public boolean[] getRooms() Retrieves the value of rooms Modifies the value of rooms public void setRooms boolean rooms[]) public Environment int agent Location, boolean[] rooms) Constructors Creates a new instance of the Environment class, using the values provided. 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 Retrieves the value of location public int getLocation() Modifies the value of location public void setLocation int location) public boolean isDirty() Retrieves the value of isDirty Modifies the value of isDirty public void setDirty 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, Environment environment) This method implements the agent's actuators, i.e., it performs a given action in the environment. private static AgentAction reflexVacuumAgent Percept percept) This method implements a Simple Reflex Agent for the Vacuum World scenarioStep 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