001    /*
002     * SimuCS - Simulator to use with Classifier Systems 
003     * MSc project - Oxford University 
004     * by Benoit Isaac - Summer 2005
005     */
006    
007    package simuLCS;
008    import java.awt.Color;
009    import java.util.Random;
010    
011    /**
012     * An agent with a Duck Behaviour described as a set of rules (using TemplateRSP).
013     * @author Benoit
014     * 
015     */
016    public class AgentClassifierDuck extends AgentClassifier {
017            
018            /**
019             * Creates the Agent with the set of rules corresponding
020             * to the duck model
021             * @param gen
022             * @param a
023             * @param name
024             */
025            public AgentClassifierDuck(Random gen, Arena a, String name)
026            {       
027                    super(gen,a,name);
028                    
029                    this.setColor_ext(Color.RED);
030                    
031                    Template t = new TemplateRSP();
032                    this.setTemplate(t);
033                    
034                    /* creating the classifiers */
035                    // c1 : ducks are attracted to each other 
036                    Classifier c1 = new Classifier("10","0001011","c1_"+this.getId());
037                    // c2 : ducks are repelled from each other (preventing collisions) 
038                    Classifier c2 = new Classifier("10","1000010","c2_"+this.getId());
039                    // c3 : ducks are repelled from obstacles
040                    Classifier c3 = new Classifier("01","1000000","c3_"+this.getId());
041                    // c4 : ducks are repelled from the robot
042                    Classifier c4 = new Classifier("11","1011110");
043                    
044                    
045                    ClassifierSet b = new ClassifierSet(t);
046                    
047                    b.addClassifier(c1);
048                    b.addClassifier(c2);
049                    b.addClassifier(c3);
050                    b.addClassifier(c4);
051                    
052                    behaviour = b ;
053                    behaviour.setTemplate(t);
054            }
055                            
056    }