public void _PopulateRations(IEnumerable <Ration> rations) { Rations.Clear(); foreach (var ration in rations) { Rations.Add(new RationModel(ration)); } }
public dynamic GetTheBestResult() { var ration = Rations.Where(r => r.Vitamins >= Vitamins && r.Minerals >= Minerals && r.Protein >= Protein && r.Fat >= Fat && r.Carbohydrates >= Carbohydrates && r.Calories >= Calories).OrderBy(r => r.Price).First(); return(ration); }
private Ration GetRation(float[] levels, float item) { for (int i = 0; i < levels.Length; i++) { if (item < levels[i]) { return(Rations[i]); } } return(Rations.Last()); }
public void Selection() { float sum = 0; Rations.ForEach(r => { r.Dispersion = Math.Abs(Vitamins - r.Vitamins) + Math.Abs(Minerals - r.Minerals) + Math.Abs(Protein - r.Protein) + Math.Abs(Fat - r.Fat) + Math.Abs(Carbohydrates - r.Carbohydrates) + Math.Abs(Calories + r.Calories); sum += r.Dispersion; }); Rations.ForEach(r => r.Likelihood = r.Dispersion / sum); }
public RationViewModel(EFDbContext context) { _context = context; repo = new EFRepository <Ration>(_context); Refresh(); Window window; if (Identity.IsAuthorized()) { window = new Rations(this); } else { window = new UnauthRations(this); } window.ShowDialog(); }
public override int GetHashCode() { int hashCode = 0; unchecked { if (unknown != null) { hashCode += 1000000007 * unknown.GetHashCode(); } hashCode += 1000000009 * Type.GetHashCode(); hashCode += 1000000021 * Gender.GetHashCode(); hashCode += 1000000033 * Race.GetHashCode(); hashCode += 1000000087 * Class.GetHashCode(); hashCode += 1000000093 * Magic.GetHashCode(); hashCode += 1000000097 * Level.GetHashCode(); hashCode += 1000000103 * Language.GetHashCode(); hashCode += 1000000123 * Appearance.GetHashCode(); hashCode += 1000000181 * Face.GetHashCode(); hashCode += 1000000207 * InventoryPicture.GetHashCode(); hashCode += 1000000223 * ActionPoints.GetHashCode(); hashCode += 1000000241 * DialogueOptions.GetHashCode(); hashCode += 1000000271 * ResponseOptions.GetHashCode(); hashCode += 1000000289 * TrainingPoints.GetHashCode(); hashCode += 1000000297 * Gold.GetHashCode(); hashCode += 1000000321 * Rations.GetHashCode(); hashCode += 1000000349 * Conditions.GetHashCode(); hashCode += 1000000363 * Strength.GetHashCode(); hashCode += 1000000403 * Intelligence.GetHashCode(); hashCode += 1000000409 * Dexterity.GetHashCode(); hashCode += 1000000411 * Speed.GetHashCode(); hashCode += 1000000427 * Stamina.GetHashCode(); hashCode += 1000000433 * Luck.GetHashCode(); hashCode += 1000000439 * MagicResistance.GetHashCode(); hashCode += 1000000447 * MagicTallent.GetHashCode(); hashCode += 1000000453 * CloseRangeCombat.GetHashCode(); hashCode += 1000000459 * LongRangeCombat.GetHashCode(); hashCode += 1000000483 * CriticalHit.GetHashCode(); hashCode += 1000000513 * Lockpicking.GetHashCode(); hashCode += 1000000531 * LifePoints.GetHashCode(); hashCode += 1000000579 * SpellPoints.GetHashCode(); hashCode += 1000000007 * Age.GetHashCode(); hashCode += 1000000009 * BaseProtection.GetHashCode(); hashCode += 1000000021 * Protection.GetHashCode(); hashCode += 1000000033 * BaseDamage.GetHashCode(); hashCode += 1000000087 * Damage.GetHashCode(); hashCode += 1000000093 * Experience.GetHashCode(); if (Spells != null) { hashCode += 1000000097 * Spells.GetHashCode(); } if (Name != null) { hashCode += 1000000103 * Name.GetHashCode(); } if (SpellStrengths != null) { hashCode += 1000000123 * SpellStrengths.GetHashCode(); } } return(hashCode); }