} //rows // Constructors public CargoShip(int width, int length) { Width = width; Length = length; for (int i = 0; i < length; i++) // for each row { for (int j = 0; j < width; j++) // for each column in the row { BalansPosition balansPosition = BalansPosition.None; if (j < (width - 1) / 2) { balansPosition = BalansPosition.Left; } else if (j == (width - 1) / 2) { balansPosition = BalansPosition.Middle; } else if (j > (width - 1) / 2) { balansPosition = BalansPosition.Right; } AddStack(new Stack(i, j, balansPosition)); } } MaximumCarryWeight = width * length * (Container.MaximumWeight + Container.MaximumCarryWeight); }
// Constructors public Stack(int row, int column, BalansPosition balansPosition) { StackID = StackIncrement; BalansPosition = balansPosition; Row = row; Column = column; if (row == 0) { HasCooling = true; } else { HasCooling = false; } IsStackableForNonValuable = true; IsStackableForValuable = true; if ((Row + 1) % 3 != 0) { IsStackInAValuableRow = true; } StackableWeight = MaxStackableWeight; StackableContainers = MaxStackableContainers; StackWeight = 0; CalcStackWeight(); StackIncrement++; }