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); }
public List <Container> PlaceHighValue(List <Container> highValueContainers) { List <Container> unplaced = new List <Container>(); foreach (var container in highValueContainers) { ShipSide side = ShipSides[GetMostEmptySide()]; List <HighValueIndex> indexes = side.GetHighValueIndexes(); if (indexes.Count == 0) { unplaced.Add(container); continue; } HighValueIndex index = indexes[random.Next(0, indexes.Count)]; if (!side.ShipSlices[index.Slice].Towers[index.Tower].ContanerSpots[index.Spot].AddContainer(container)) { unplaced.Add(container); } } return(unplaced); }