Exemple #1
0
		public void moveObject(Agent a, String direction) 
		{
			XYLocation presentLocation = (XYLocation) a.getAttribute(LOCATION);
			XYLocation locationToMoveTo = presentLocation.locationAt(direction);

			if (!(isBlocked(locationToMoveTo))) 
			{
				moveObjectToAbsoluteLocation(a, locationToMoveTo);
			}

		}
Exemple #2
0
		public ArrayList getObjectsNear(Agent agent, int radius) 
		{
			ArrayList retval = new ArrayList();

				XYLocation agentLocation = (XYLocation) agent.getAttribute(LOCATION);

			ArrayList all = getAllObjects();
			foreach (ObjectWithDynamicAttributes a in all) 
			{
				if (!(a.Equals(agent))) 
				{
					XYLocation otherAgentLocation = (XYLocation) a
						.getAttribute(LOCATION);
					if (withinRadius(radius, agentLocation, otherAgentLocation)) 
					{
						retval.Add(a);
					}
				}
			}
			return retval;
		}
Exemple #3
0
		public abstract Percept getPerceptSeenBy(Agent anAgent);
Exemple #4
0
		public abstract void executeAction(Agent a, String act);
Exemple #5
0
		public void addAgent(Agent a) 
		{
			if (!(alreadyContains(a))) 
			{
				agents.Add(a);
			}
		}
Exemple #6
0
		public void addAgent(Agent a, string attributeName, Object attributeValue) 
		{
			if (!(alreadyContains(a))) 
			{
				a.setAttribute(attributeName, attributeValue);
				agents.Add(a);
			}
		}
Exemple #7
0
		public bool alreadyContains(Agent anAgent) 
		{
			bool retval = false;
			foreach (Agent agent in agents) 
			{
				//if (agent.equals(anAgent)) 
				if (agent.Equals(anAgent)) 
				{
					retval = true;
				}
			}
			return retval;
		}
Exemple #8
0
		public void moveObjectToAbsoluteLocation(Agent a, XYLocation loc) 
		{

			a.setAttribute(LOCATION, loc);

		}
Exemple #9
0
		public void addAgent(Agent a, XYLocation loc) 
		{
			base.addAgent(a, LOCATION, loc);
		}
Exemple #10
0
		public override Percept getPerceptSeenBy(Agent anAgent) 
		{
			return new Percept();
		}
Exemple #11
0
		public override void executeAction(Agent a, String Action) 
		{

		}