示例#1
0
        private float L(float t, PhysicalState ps, SensorObject target)
        {
            var Ht              = this.hunger;
            var internalUrge    = ps.Lx(ps.timeSinceLastMating) * (1 - Ht);
            var externalStimuli = this.Sl(target);

            var L = math.min(internalUrge + externalStimuli, 1);

            this.libido = L;

            return(this.libido);
        }
示例#2
0
        private float H(float t, PhysicalState ps, SensorObject target)
        {
            var internalUrge    = 1 - ps.foodEaten * ps.Rx(ps.timeSinceLastMeal) / ps.appetite;
            var externalStimuli = ps.alphah * this.Sh(target);


            var H = math.min(internalUrge + externalStimuli, 1);

            this.hunger = H;

            return(this.hunger);
        }
示例#3
0
        public void SetClosest(ISensorableObject obj, float distance)
        {
            var type   = obj.ObjType;
            var newObj = new SensorObject()
            {
                obj = obj, distance = distance
            };

            if (this.closestObjects.ContainsKey(type))
            {
                this.closestObjects[type] = newObj;
            }
            else
            {
                this.closestObjects.Add(type, newObj);
            }
        }
示例#4
0
        public void Clear()
        {
            foreach (var l in this.currentSensorableObjects.Values)
            {
                l.Clear();
            }
            foreach (var l in this.currentVisiableObjects.Values)
            {
                l.Clear();
            }
            foreach (var l in this.currentDangerObjects.Values)
            {
                l.Clear();
            }

            this.closestObjects.Clear();
            this.closestDangerObj = null;
        }
示例#5
0
        protected float S(SensorObject target, float q1, float q2)
        {
            if (target == null)
            {
                return(0);
            }

            var s = 1 / target.distance;

            if (s < q1)
            {
                return(0);
            }
            else
            if (q1 <= s && s <= q2)
            {
                return((s - q1) / (2 * q2 - q1 - s));
            }
            else
            {
                return(1);
            }
        }
示例#6
0
 private float Sl(SensorObject target)
 {
     return(this.S(target, 0.025f, 0.1f));
 }
示例#7
0
 private float Sh(SensorObject target)
 {
     return(this.S(target, 0.05f, 0.2f));
 }