/*
* File name: CleaningAgent.java (package eas.simulation.spatial.standardBrains.mdle.testing.pacman)
* Author(s): Funky
* Java version: 6.0
* Generation date: Jan 9, 2011 (3:03:49 PM)
*
* (c) This file and the EAS (Easy Agent Simulation) framework containing it
* is protected by Creative Commons by-nc-sa license. Any altered or
* further developed versions of this file have to meet the agreements
* stated by the license conditions.
*
* In a nutshell
* -------------
* You are free:
* - to Share -- to copy, distribute and transmit the work
* - to Remix -- to adapt the work
*
* Under the following conditions:
* - Attribution -- You must attribute the work in the manner specified by the
* author or licensor (but not in any way that suggests that they endorse
* you or your use of the work).
* - Noncommercial -- You may not use this work for commercial purposes.
* - Share Alike -- If you alter, transform, or build upon this work, you may
* distribute the resulting work only under the same or a similar license to
* this one.
*
* + Detailed license conditions (Germany):
* http://creativecommons.org/licenses/by-nc-sa/3.0/de/
* + Detailed license conditions (unported):
* http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en
*
* This header must be placed in the beginning of any version of this file.
*/
package eas.users.students.danielFunke.pacman;
import java.awt.Color;
import java.io.File;
import eas.simulation.brain.BrainControlled;
import eas.simulation.spatial.sim2D.standardAgents.AbstractAgent2D;
import eas.simulation.spatial.sim2D.standardAgents.PacmanAgent2D;
import eas.simulation.spatial.sim2D.standardEnvironments.AbstractEnvironment2D;
import eas.simulation.spatial.standardBrains.mdle.MDL2eBrain;
import eas.startSetup.ParCollection;
import eas.users.students.danielFunke.pacman.components.CleanActuator;
import eas.users.students.danielFunke.pacman.components.DirtFrontSensor;
import eas.users.students.danielFunke.pacman.components.DirtHereSensor;
import eas.users.students.danielFunke.pacman.components.DirtLeftSensor;
import eas.users.students.danielFunke.pacman.components.DirtRearSensor;
import eas.users.students.danielFunke.pacman.components.DirtRightSensor;
import eas.users.students.danielFunke.pacman.components.MoveActuator;
import eas.users.students.danielFunke.pacman.components.RotateActuator;
import eas.users.students.danielFunke.pacman.components.TouchInterrupt;
import eas.users.students.danielFunke.pacman.components.TrueInterrupt;
/**
* @author Funky
*
*/
public class CleaningAgent extends PacmanAgent2D implements BrainControlled<MDL2eBrain<?>> {
/**
*
*/
private static final long serialVersionUID = -8122470950973581906L;
/**
* @param id
* @param env
*/
public CleaningAgent(int id, AbstractEnvironment2D<AbstractAgent2D<?>> env, ParCollection params) {
super(id, env, params);
this.addSensor(new DirtHereSensor());
this.addSensor(new DirtFrontSensor());
this.addSensor(new DirtRearSensor());
this.addSensor(new DirtLeftSensor());
this.addSensor(new DirtRightSensor());
this.addSensor(new TrueInterrupt());
this.addSensor(new TouchInterrupt());
this.addActuator(new CleanActuator());
this.addActuator(new MoveActuator());
this.addActuator(new RotateActuator());
this.implantBrain(new MDL2eBrain<AbstractAgent2D<?>>(this, new File("eas/users/students/danielFunke/pacman/CleaningAgent.xml")));
}
/* (non-Javadoc)
* @see eas.simulation.spatial.sim2D.standardAgents.PacmanAgent2D#getColor()
*/
@Override
public Color getAgentColor() {
if(this.getBrain().isActive())
return Color.yellow;
else
return Color.red;
}
/*
* Der folgende Teil ist durch das neue Interface "BrainControlled"
* notwendig geworden. Jeder Agent, der von einem Brain kontrolliert
* werden soll, muss jetzt diesen Getter und diesen Setter manuell
* implementieren. Der Vorteil ist, dass jetzt auch das Brain typsicher
* ist (müsste man in deiner Implementierung aber noch einbauen). (Lukas)
*/
private MDL2eBrain<?> mdl2eBrain;
@Override
public void implantBrain(MDL2eBrain<?> setBrain) {
this.mdl2eBrain = setBrain;
}
@Override
public MDL2eBrain<?> getBrain() {
return this.mdl2eBrain;
}
}