public List <Container> PlaceNormal(List <Container> normalContainers) { List <Container> unplaced = new List <Container>(); foreach (var container in normalContainers) { ShipSide side = ShipSides[GetMostEmptySide()]; ShipSlice shipslice = side.ShipSlices[side.GetMostEmptySlice()]; ShipTower tower = shipslice.Towers[shipslice.GetMostEmptyTower()]; if (!tower.ContainerFits(container)) { unplaced.Add(container); } else { ContainerSpot spot = tower.ContanerSpots[tower.GetFirstEmptySpot()]; if (!spot.AddContainer(container)) { unplaced.Add(container); } } } Console.WriteLine("Containers not placed " + unplaced.Count); return(unplaced); }
public List <Container> PlaceCooled(List <Container> cooledContainers) { List <Container> unplaced = new List <Container>(); foreach (var container in cooledContainers) { ShipSide side = ShipSides[GetMostEmptySide()]; ShipSlice slice = side.ShipSlices[side.GetMostEmptyCooledSlice()]; ShipTower tower = slice.Towers[0]; if (!tower.ContainerFits(container)) { unplaced.Add(container); } else { ContainerSpot spot = tower.ContanerSpots[tower.GetFirstEmptySpot()]; if (!spot.AddContainer(container)) { unplaced.Add(container); } } } Console.WriteLine(unplaced.Count + " Containers not placed"); return(unplaced); }