// Check whether the bottom container can support the weight. private bool DoesNotGetCrushed(IContainer container) { for (int i = 0; i < Containers.Count; i++) { int topWeight = 0; var topContainers = Containers.GetRange(i + 1, Containers.Count - i - 1); topContainers.Add(container); foreach (IContainer stackedContainer in topContainers) { topWeight += stackedContainer.Weight; } if (topWeight > 120) { return(false); } } return(true); }