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); }
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); }
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); } }
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; }
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); } }
private float Sl(SensorObject target) { return(this.S(target, 0.025f, 0.1f)); }
private float Sh(SensorObject target) { return(this.S(target, 0.05f, 0.2f)); }