public SteeringBehaviours(Fighter entity) { this.fighter = entity; calculationMethod = CalculationMethods.WeightedTruncatedRunningSumWithPrioritisation; sphere = new Sphere(0.2f); XNAGame.Instance().Children.Add(sphere); wanderTarget = new Vector3(randomClamped(), randomClamped(), randomClamped()); wanderTarget.Normalize(); weights.Add(behaviour_type.allignment, 1.0f); weights.Add(behaviour_type.cohesion, 2.0f); weights.Add(behaviour_type.obstacle_avoidance, 20.0f); weights.Add(behaviour_type.wall_avoidance, 20.0f); weights.Add(behaviour_type.wander, 1.0f); weights.Add(behaviour_type.seek, 1.0f); weights.Add(behaviour_type.flee, 1.0f); weights.Add(behaviour_type.arrive, 1.0f); weights.Add(behaviour_type.pursuit, 1.0f); weights.Add(behaviour_type.offset_pursuit, 1.0f); weights.Add(behaviour_type.interpose, 1.0f); weights.Add(behaviour_type.hide, 1.0f); weights.Add(behaviour_type.evade, 0.01f); weights.Add(behaviour_type.follow_path, 1.0f); weights.Add(behaviour_type.separation, 1.0f); }
public Calculator(CalculationMethods m, AsrJuristics a, HighLatitudeMethods h) { _calcMethod = MethodFactory.Build(m); InitSettings(a, h); InitOffsets(); }
public SteeringBehaviours() { force = Vector3.zero; velocity = Vector3.zero; mass = 1.0f; flags = 0; calculationMethod = CalculationMethods.WeightedTruncatedRunningSumWithPrioritisation; target = null; leader = null; }
public SteeringBehaviours() { force = Vector3.zero; velocity = Vector3.zero; mass = 1.0f; TurnOffAll(); calculationMethod = CalculationMethods.WeightedTruncatedRunningSumWithPrioritisation; target = null; leader = null; maxSpeed = Params.GetFloat("max_speed"); maxForce = Params.GetFloat("max_force"); wanderTargetPos = UnityEngine.Random.insideUnitSphere * Params.GetFloat("wander_radius"); }
public SteeringBehaviours() { force = Vector3.zero; velocity = Vector3.zero; mass = 1.0f; TurnOffAll(); calculationMethod = CalculationMethods.WeightedTruncatedRunningSumWithPrioritisation; target = null; leader = null; maxSpeed = Params.GetFloat("max_speed"); maxForce = Params.GetFloat("max_force"); // wanderTargetPos = UnityEngine.Random.insideUnitSphere * Params.GetFloat("wander_radius"); }
public SteeringBehaviours(Fighter entity) { this.fighter = entity; calculationMethod = CalculationMethods.WeightedTruncatedRunningSumWithPrioritisation; sphere = new Sphere(0.2f); wanderSphere = new Sphere(1); wanderSphere.ShouldDraw = false; sphere.ShouldDraw = false; XNAGame.Instance().Children.Add(sphere); XNAGame.Instance().Children.Add(wanderSphere); wanderTarget = new Vector3(RandomClamped(), RandomClamped(), RandomClamped()); wanderTarget.Normalize(); wanderTarget *= Params.GetFloat("wander_radius"); }
public SteeringBehaviours(Fighter entity) { this.fighter = entity; calculationMethod = CalculationMethods.WeightedTruncatedRunningSumWithPrioritisation; sphere = new Sphere(0.2f); wanderSphere = new Sphere(1); wanderSphere.ShouldDraw = false; sphere.ShouldDraw = false; XNAGame.Instance.Children.Add(sphere); XNAGame.Instance.Children.Add(wanderSphere); wanderTarget = new Vector3(RandomClamped(), RandomClamped(), RandomClamped()); wanderTarget.Normalize(); wanderTarget *= Params.GetFloat("wander_radius"); }
static void Main() { string[] input = Console.ReadLine().Split(' '); int[] numbers = new int[input.Length]; for (int i = 0; i < input.Length; i++) { numbers[i] = int.Parse(input[i]); } int minNumber = CalculationMethods.MinimumNumber(numbers); int maxNumber = CalculationMethods.MaximumNumber(numbers); int sum = CalculationMethods.MaximumNumber(numbers); double average = CalculationMethods.Average(numbers); long product = CalculationMethods.Product(numbers); Console.WriteLine("Max: {0}; Min: {1}; Sum: {2}; Average: {3:F2}; Product: {4}", maxNumber, minNumber, sum, average, product); }
public static Method Build(CalculationMethods m) { Method toReturn; switch(m) { case CalculationMethods.MWL: toReturn = BuildForMwl(); break; case CalculationMethods.ISNA: toReturn = BuildForIsna(); break; case CalculationMethods.Egypt: toReturn = BuildForEgypt(); break; case CalculationMethods.Makkah: toReturn = BuildForMakkah(); break; case CalculationMethods.Karachi: toReturn = BuildForKarachi(); break; case CalculationMethods.Tehran: toReturn = BuildForTehran(); break; case CalculationMethods.Jafari: toReturn = BuildForJafari(); break; default: toReturn = BuildForMakkah(); break; } return toReturn; }
public static Params GetMethodsParams(CalculationMethods calculationMethods, Params customParams) { switch (calculationMethods) { case CalculationMethods.Jafari: // { 16, 0, 4, 0, 14 }; return(new Params { ImsakTime = 10, FajrAngle = 16, MaghribSelector = Kind.Angle, MaghribParameter = 4, IshaSelector = Kind.Angle, IshaParameter = 14, }); case CalculationMethods.Karachi: // { 18, 1, 0, 0, 18 }; return(new Params { ImsakTime = 10, FajrAngle = 18, MaghribSelector = Kind.Minute, MaghribParameter = 0, IshaSelector = Kind.Angle, IshaParameter = 18, }); case CalculationMethods.ISNA: // { 15, 1, 0, 0, 15 }; return(new Params { ImsakTime = 10, FajrAngle = 15, MaghribSelector = Kind.Minute, MaghribParameter = 0, IshaSelector = Kind.Angle, IshaParameter = 15, }); case CalculationMethods.MWL: // { 18, 1, 0, 0, 17 }; return(new Params { ImsakTime = 10, FajrAngle = 18, MaghribSelector = Kind.Minute, MaghribParameter = 0, IshaSelector = Kind.Angle, IshaParameter = 17, }); case CalculationMethods.Makkah: // { 19, 1, 0, 1, 90 }; return(new Params { ImsakTime = 10, FajrAngle = 19, MaghribSelector = Kind.Minute, MaghribParameter = 0, IshaSelector = Kind.Minute, IshaParameter = 90, }); case CalculationMethods.Egypt: // { 19.5, 1, 0, 0, 17.5 }; return(new Params { ImsakTime = 10, FajrAngle = 19.5, MaghribSelector = Kind.Minute, MaghribParameter = 0, IshaSelector = Kind.Angle, IshaParameter = 17.5, }); case CalculationMethods.Kemenag: // { 20, 0, 0, 0, 18 }; return(new Params { ImsakTime = 10, FajrAngle = 20, MaghribSelector = Kind.Angle, MaghribParameter = 0, IshaSelector = Kind.Angle, IshaParameter = 18, }); case CalculationMethods.Custom: // { 18, 1, 0, 0, 17 }; return(customParams ?? new Params { ImsakTime = 10, FajrAngle = 18, MaghribSelector = Kind.Minute, MaghribParameter = 0, IshaSelector = Kind.Angle, IshaParameter = 17, }); default: throw new ArgumentOutOfRangeException(nameof(calculationMethods)); } }
public Boid() { TurnOffAll(); drawGizmos = false; drawForces = false; drawVectors = false; drawNeighbours = false; applyBanking = true; flock = null; // Set default values force = Vector3.zero; velocity = Vector3.zero; mass = 1.0f; damping = 0.01f; radius = 5.0f; forceMultiplier = 1.0f; timeMultiplier = 1.0f; neighbourDistance = 10.0f; calculationMethod = CalculationMethods.WeightedTruncatedRunningSumWithPrioritisation; seekTargetPos = Vector3.zero; seekWeight = 1.0f; fleeWeight = 1.0f; fleeTarget = null; fleeRange = 100.0f; arriveSlowingDistance = 15.0f; arriveDeceleration = 0.9f; arriveTargetPos = Vector3.zero; arriveWeight = 1.0f; wanderRadius = 10.0f; wanderDistance = 15.0f; wanderJitter = 20.0f; wanderWeight = 1.0f; wanderNoiseX = 0; wanderNoiseDelta = 0.01f; cohesionWeight = 1.0f; separationWeight = 1.0f; alignmentWeight = 1.0f; obstacleAvoidanceWeight = 1.0f; minBoxLength = 50.0f; followPathWeight = 1.0f; pursuitWeight = 1.0f; pursuitTarget = null; evadeTarget = null; evadeWeight = 1.0f; interposeWeight = 1.0f; hideWeight = 1.0f; planeAvoidanceWeight = 1.0f; offsetPursuitTarget = null; offsetPursuitWeight = 1.0f; sphereCentre = Vector3.zero; sphereConstrainWeight = 1.0f; sphereRadius = 1000.0f; randomWalkWeight = 1.0f; randomWalkCenter = Vector3.zero; randomWalkRadius = 500.0f; randomWalkKeepY = false; randomWalkForce = Vector3.zero; randomWalkWait = 5.0f; maxSpeed = 20; maxForce = 10; sceneAvoidanceEnabled = true; sceneAvoidanceWeight = 1.0f; sceneAvoidanceFeelerDepth = 30.0f; }
private void loadSettings() { if (AppSettings.loadSettings("countryFullName") != null) App.countryFullName = Convert.ToString(AppSettings.loadSettings("countryFullName")); if (AppSettings.loadSettings("ln") != null) App.ln = Convert.ToDouble(AppSettings.loadSettings("ln")); if (AppSettings.loadSettings("lt") != null) App.lt = Convert.ToDouble(AppSettings.loadSettings("lt")); if (AppSettings.loadSettings("backgroundImage") != null) App.backgroundImage = Convert.ToString(AppSettings.loadSettings("backgroundImage")); if (AppSettings.loadSettings("fajrNotification") != null) App.fajrNotification = Convert.ToInt32(AppSettings.loadSettings("fajrNotification")); if (AppSettings.loadSettings("dhuhrNotification") != null) App.dhuhrNotification = Convert.ToInt16(AppSettings.loadSettings("dhuhrNotification")); if (AppSettings.loadSettings("asrNotification") != null) App.asrNotification = Convert.ToInt16(AppSettings.loadSettings("asrNotification")); if (AppSettings.loadSettings("maghribNotification") != null) App.maghribNotification = Convert.ToInt16(AppSettings.loadSettings("maghribNotification")); if (AppSettings.loadSettings("ishaNotification") != null) App.ishaNotification = Convert.ToInt16(AppSettings.loadSettings("ishaNotification")); if (AppSettings.loadSettings("fajrAdjustment") != null) App.fajrAdjustment = Convert.ToDouble(AppSettings.loadSettings("fajrAdjustment")); if (AppSettings.loadSettings("dhuhrAdjustment") != null) App.dhuhrAdjustment = Convert.ToDouble(AppSettings.loadSettings("dhuhrAdjustment")); if (AppSettings.loadSettings("asrAdjustment") != null) App.asrAdjustment = Convert.ToDouble(AppSettings.loadSettings("asrAdjustment")); if (AppSettings.loadSettings("maghribAdjustment") != null) App.maghribAdjustment = Convert.ToDouble(AppSettings.loadSettings("maghribAdjustment")); if (AppSettings.loadSettings("ishaAdjustment") != null) App.ishaAdjustment = Convert.ToDouble(AppSettings.loadSettings("ishaAdjustment")); if (AppSettings.loadSettings("isDST") != null) App.isDST = Convert.ToBoolean(Convert.ToInt16(AppSettings.loadSettings("isDST"))); if (AppSettings.loadSettings("timeZone") != null) App.timeZone = Convert.ToInt32(Convert.ToInt16(AppSettings.loadSettings("timeZone"))); if (AppSettings.loadSettings("timeZoneSelectedIndex") != null) App.timeZone = Convert.ToInt32(Convert.ToInt16(AppSettings.loadSettings("timeZoneSelectedIndex"))); if (AppSettings.loadSettings("displayTimeFormat") != null) App.displayTimeFormat = (TimeFormats)Enum.Parse(typeof(TimeFormats), AppSettings.loadSettings("displayTimeFormat")); if (AppSettings.loadSettings("cm") != null) App.cm = (CalculationMethods)Enum.Parse(typeof(CalculationMethods), AppSettings.loadSettings("cm")); if (AppSettings.loadSettings("hlm") != null) App.hlm = (HighLatitudeMethods)Enum.Parse(typeof(HighLatitudeMethods), AppSettings.loadSettings("hlm")); if (AppSettings.loadSettings("aj") != null) App.aj = (AsrJuristics)Enum.Parse(typeof(AsrJuristics), AppSettings.loadSettings("aj")); if (AppSettings.loadSettings("translationLanguage") != null) App.translationLanguage = AppSettings.loadSettings("translationLanguage"); if (AppSettings.loadSettings("quranChapterNameLang") != null) App.quranChapterNameLang = Convert.ToInt16(AppSettings.loadSettings("quranChapterNameLang")); if (AppSettings.loadSettings("quranReadingBookmark") != null) App.quranReadingBookmark = AppSettings.loadSettings("quranReadingBookmark"); if (AppSettings.loadSettings("scheduleFactorySetupDate") == null) App.scheduleFactorySetupDate = new DateTime().Date.AddYears(-1); else App.scheduleFactorySetupDate = Convert.ToDateTime(AppSettings.loadSettings("scheduleFactorySetupDate")); }