Example #1
0
 public bool isValid(Backpack pack) => pack.TotalWeight <= _maxWeight;
Example #2
0
 private void printPack(string info, Backpack pack)
 {
     Console.WriteLine(info + $"{itemsPresentation()} \n" +
                       $"{string.Join("\t  ", pack.Presentation(_baseItems))}" + $"\t TotalWeight - {pack.TotalWeight}, " + $"TotalWorth - {pack.TotalWorth}");
 }
Example #3
0
 public static IEnumerable <int> Presentation(this Backpack pack, List <Item> items) =>
 items.Select(x => pack.Items.Contains(x) ? 1 : 0);