Beispiel #1
0
        public ClarionAgent(WSProxy nws, String creature_ID, String creature_Name)
        {
            worldServer = nws;
            // Initialize the agent
            CurrentAgent = World.NewAgent("Current Agent");
            mind         = new MindViewer();
            mind.Show();
            creatureId   = creature_ID;
            creatureName = creature_Name;

            // Initialize Input Information
            inputWallAhead      = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_WALL_AHEAD);
            inputFoodAhead      = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_FOOD_AHEAD);
            inputJewelAhead     = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_AHEAD);
            inputDistantJewel   = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_DISTANT_JEWEL);
            inputDistantFood    = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_DISTANT_FOOD);
            inputDeliverLeaflet = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_DELIVER_LEAFLET);

            // Initialize Output actions
            outputRotateClockwise = World.NewExternalActionChunk(CreatureActions.ROTATE_CLOCKWISE.ToString());
            //outputGoAhead = World.NewExternalActionChunk(CreatureActions.GO_AHEAD.ToString());
            outputGoToClosestJewel = World.NewExternalActionChunk(CreatureActions.GO_TO_CLOSEST_JEWEL.ToString());
            outputGoToClosestFood  = World.NewExternalActionChunk(CreatureActions.GO_TO_CLOSEST_FOOD.ToString());
            outputEatFood          = World.NewExternalActionChunk(CreatureActions.EAT_FOOD.ToString());
            outputSackJewel        = World.NewExternalActionChunk(CreatureActions.SACK_JEWEL.ToString());
            outputDeliverLeaflet   = World.NewExternalActionChunk(CreatureActions.PREPARE_TO_DELIVER_LEAFLET.ToString());
            outputStop             = World.NewExternalActionChunk(CreatureActions.STOP.ToString());

            //Create thread to simulation
            runThread = new Thread(CognitiveCycle);
            Console.WriteLine("Agent started");
        }
Beispiel #2
0
        public ClarionAgent(WSProxy nws, String creature_ID, String creature_Name)
        {
            worldServer = nws;
            // Initialize the agent
            CurrentAgent = World.NewAgent("Current Agent");
            mind         = new MindViewer();
            mind.Show();
            creatureId   = creature_ID;
            creatureName = creature_Name;

            // Initialize Input Information
            inputWallAhead  = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_WALL_AHEAD);
            inputFoodAhead  = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_FOOD_AHEAD);
            inputJewelAhead = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_AHEAD);
            inputNeedJewel  = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_NEED_JEWEL);


            // Initialize Output actions
            outputRotateClockwise = World.NewExternalActionChunk(CreatureActions.ROTATE_CLOCKWISE.ToString());
            outputGoAhead         = World.NewExternalActionChunk(CreatureActions.GO_AHEAD.ToString());
            outputGetJewel        = World.NewExternalActionChunk(CreatureActions.GET_JEWEL.ToString());
            outputEatFood         = World.NewExternalActionChunk(CreatureActions.EAT_FOOD.ToString());
            outputGoToJewel       = World.NewExternalActionChunk(CreatureActions.GO_TO_JEWEL.ToString());

            //Create thread to simulation
            runThread = new Thread(CognitiveCycle);
            Console.WriteLine("Agent started");
        }
Beispiel #3
0
        public ClarionAgent(WSProxy nws, String creature_ID, String creature_Name, List <Leaflet> leafletList)
        {
            worldServer = nws;
            // Initialize the agent
            CurrentAgent = World.NewAgent("Current Agent");
            mind         = new MindViewer();
            mind.Show();
            creatureId   = creature_ID;
            creatureName = creature_Name;

            // Initialize Input Information
            inputWallCreatureAhead = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_WALL_AHEAD);
            inputFoodAhead         = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_FOOD_AHEAD);
            inputJewelAhead        = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_AHEAD);
            inputJewelInVision     = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_IN_VISION);
            inputFuelLow           = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_FUEL_LOW);

            // Initialize Output actions
            outputRotateClockwise   = World.NewExternalActionChunk(CreatureActions.ROTATE_CLOCKWISE.ToString());
            outputGoAhead           = World.NewExternalActionChunk(CreatureActions.GO_AHEAD.ToString());
            outputEatFood           = World.NewExternalActionChunk(CreatureActions.EAT_FOOD.ToString());
            outputGetJewel          = World.NewExternalActionChunk(CreatureActions.GET_JEWEL.ToString());
            outputHideJewel         = World.NewExternalActionChunk(CreatureActions.HIDE_JEWEL.ToString());
            outputGoalAchieved      = World.NewExternalActionChunk(CreatureActions.GOAL_ACHIEVED.ToString());
            outputGoToJewelInVision = World.NewExternalActionChunk(CreatureActions.GO_TO_JEWEL.ToString());
            outputFuelLow           = World.NewExternalActionChunk(CreatureActions.FUEL_LOW.ToString());

            //List<Thing> listThing = nws.SendGetCreatureState (creature_ID);

            //IList<Thing> response = null;

            //if (worldServer != null && worldServer.IsConnected) {
            //	response = worldServer.SendGetCreatureState (creatureName);
            //		Creature cc = (Creature)response [0];
            //		leaflet1.leafletID = cc.leaflets [0].leafletID;
            //		leaflet2.leafletID = cc.leaflets [1].leafletID;
            //		leaflet3.leafletID = cc.leaflets [2].leafletID;
            //		Console.WriteLine ("Creature found: " + cc.Name);
            //		Console.WriteLine ("LF1: " + cc.leaflets [0].leafletID);
            //		Console.WriteLine ("LF2: " + cc.leaflets [1].leafletID);
            //		Console.WriteLine ("LF3: " + cc.leaflets [2].leafletID);
            //}

            // Load leaflet control
            loadLeafletsControl(leafletList);
            mind.loadLeaflet(leafletList[0], leafletList[1], leafletList[2]);

            //Create thread to simulation
            runThread = new Thread(CognitiveCycle);
            //Console.WriteLine ("Agent started");
        }
Beispiel #4
0
        public ClarionAgent(WSProxy nws, String creature_ID, String creature_Name)
        {
            worldServer = nws;
            // Initialize the agent
            CurrentAgent = World.NewAgent("Current Agent");
            mind         = new MindViewer();
            mind.Show();
            creatureId   = creature_ID;
            creatureName = creature_Name;

            // Initialize Input Information
            inputWallCreatureAhead = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_WALL_AHEAD);
            inputFoodAhead         = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_FOOD_AHEAD);
            inputJewelAhead        = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_AHEAD);
            inputJewelInVision     = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_IN_VISION);

            // Initialize Output actions
            outputRotateClockwise   = World.NewExternalActionChunk(CreatureActions.ROTATE_CLOCKWISE.ToString());
            outputGoAhead           = World.NewExternalActionChunk(CreatureActions.GO_AHEAD.ToString());
            outputEatFood           = World.NewExternalActionChunk(CreatureActions.EAT_FOOD.ToString());
            outputGetJewel          = World.NewExternalActionChunk(CreatureActions.GET_JEWEL.ToString());
            outputHideJewel         = World.NewExternalActionChunk(CreatureActions.HIDE_JEWEL.ToString());
            outputGoalAchieved      = World.NewExternalActionChunk(CreatureActions.GOAL_ACHIEVED.ToString());
            outputGoToJewelInVision = World.NewExternalActionChunk(CreatureActions.GO_TO_JEWEL.ToString());

            /*List<Thing> thingList = nws.SendGetCreatureState (creature_ID);
             * foreach(Thing t in thingList) {
             *      Console.WriteLine ("Thing: ");
             *      Console.Write (t);
             * }*/



            // Define jewels out of scope
            jewelOutOfScope.Add("Orange");
            jewelOutOfScope.Add("DarkGray_Spoiled");

            //Create thread to simulation
            runThread = new Thread(CognitiveCycle);
            Console.WriteLine("Agent started");
        }
Beispiel #5
0
        // To indicate we are done.
        //Boolean allJewelsCollected = false;
        //Boolean reachedDeliverySpot = false;
        #endregion

        #region Constructor
        public ClarionAgent(WSProxy nws, String creature_ID, String creature_Name)
        {
            worldServer = nws;
            // Initialize the agent
            CurrentAgent = World.NewAgent("Current Agent");
            mind         = new MindViewer();
            mind.Show();
            creatureId   = creature_ID;
            creatureName = creature_Name;

            // Create a (fake) delivery spot.
            // It seems WSProxy.cs does not support it, so place it at (0,0).
            deliverySpot    = new Thing();
            deliverySpot.X1 = 0;
            deliverySpot.Y1 = 0;

            // Initialize Input Information
            inputWallAhead          = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_WALL_AHEAD);
            inputJewelAhead         = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_AHEAD);
            inputFoodAhead          = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_FOOD_AHEAD);
            inputJewelAway          = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_JEWEL_AWAY);
            inputFoodAway           = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_FOOD_AWAY);
            inputAllJewelsCollected = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_ALL_JEWELS_COLLECTED);
            inputCreatureCanDeliver = World.NewDimensionValuePair(SENSOR_VISUAL_DIMENSION, DIMENSION_CREATURE_CAN_DELIVER);

            // Initialize Output actions
            outputRotateClockwise  = World.NewExternalActionChunk(CreatureActions.ROTATE_CLOCKWISE.ToString());
            outputGetJewel         = World.NewExternalActionChunk(CreatureActions.GET_JEWEL.ToString());
            outputGetFood          = World.NewExternalActionChunk(CreatureActions.GET_FOOD.ToString());
            outputGoToJewel        = World.NewExternalActionChunk(CreatureActions.GO_TO_JEWEL.ToString());
            outputGoToFood         = World.NewExternalActionChunk(CreatureActions.GO_TO_FOOD.ToString());
            outputWander           = World.NewExternalActionChunk(CreatureActions.WANDER.ToString());
            outputGoToDeliverySpot = World.NewExternalActionChunk(CreatureActions.GO_TO_DELIVER.ToString());
            outputDoDelivery       = World.NewExternalActionChunk(CreatureActions.DELIVER.ToString());

            //Create thread to simulation
            runThread = new Thread(CognitiveCycle);
            Console.WriteLine("Agent started");
        }