Exemplo n.º 1
0
        public bool AddContainer(ShipContainer container)
        {
            int stackedWeight = 0;

            for (int i = 1; i < containers.Count; i++)
            {
                stackedWeight += containers[i].Weight;
            }

            if (stackedWeight + container.Weight > 120000)
            {
                return(false);
            }

            containers.Add(container);
            height++;
            return(true);
        }
Exemplo n.º 2
0
        public bool AddCooledContainer(ShipContainer c, Types.Sides side)
        {
            foreach (var pile in piles)
            {
                Point point = pile.Location;
                if (IsEven)
                {
                    if (side == Types.Sides.Left)
                    {
                        if (point.X == 0 && point.Y + 1 <= Size.Height / 2)
                        {
                            if (CheckForValueables(pile))
                            {
                                if (pile.AddContainer(c))
                                {
                                    return(true);
                                }
                            }
                        }
                    }

                    if (side == Types.Sides.Right)
                    {
                        if (point.X == 0 && point.Y + 1 > Size.Height / 2)
                        {
                            if (CheckForValueables(pile))
                            {
                                if (pile.AddContainer(c))
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (side == Types.Sides.Left)
                    {
                        if (point.X == 0 && point.Y + 1 <= Size.Height / 2)
                        {
                            if (CheckForValueables(pile))
                            {
                                if (pile.AddContainer(c))
                                {
                                    return(true);
                                }
                            }
                        }
                    }

                    if (side == Types.Sides.Right)
                    {
                        if (point.X == 0 && point.Y + 1 > (Size.Height / 2) + 1)
                        {
                            if (CheckForValueables(pile))
                            {
                                if (pile.AddContainer(c))
                                {
                                    return(true);
                                }
                            }
                        }
                    }

                    if (side == Types.Sides.Middle)
                    {
                        if (point.X == 0 && point.Y + 1 == (Size.Height / 2) + 1)
                        {
                            if (CheckForValueables(pile))
                            {
                                if (pile.AddContainer(c))
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }