package aima.basic.vaccum;

import aima.basic.AgentProgram;
import aima.basic.Percept;

/**
 * @author Ravi Mohan
 * 
 */
public class ModelBasedTVEVaccumAgentProgram extends AgentProgram {
	VaccumEnvironmentModel myModel;

	ModelBasedTVEVaccumAgentProgram(VaccumEnvironmentModel model) {
		myModel = model;
	}

	@Override
	public String execute(Percept percept) {
		String location = (String) percept.getAttribute("location");
		String locationStatus = (String) percept.getAttribute("status");
		myModel.setLocationStatus(location, locationStatus);

		if (myModel.bothLocationsClean()) {
			return "NoOp";
		} else if (locationStatus.equals("Dirty")) {
			return "Suck";
		} else if (location.equals("A")) {
			return "Right";
		} else if (location.equals("B")) {
			return "Left";
		} else
			return "None";

	}

}
@@ -23,16 +23,42 @@
 cum;%0D%0A%0D%0A
+import aima.basic.Agent;%0D%0A
 import a
@@ -645,14 +645,19 @@
 urn 
-%22NoOp%22
+Agent.NO_OP
 ;%0D%0A%09

Return value of execute method fixed (NoOP).