public bool HaveSthSimilar(ProductsSet other)
 {
     for (int i = 0; i < Simulation.ProductsCount; i++)
     {
         if (Items[i] > 0 && other.Items[i] > 0)
         {
             return true;
         }
     }
     return false;
 }
 public bool HaveSthSimilar(ProductsSet other)
 {
     for (int i = 0; i < Simulation.ProductsCount; i++)
     {
         if (Items[i] > 0 && other.Items[i] > 0)
         {
             return(true);
         }
     }
     return(false);
 }
 public static Warehouse findCLosestWarehouse(List<Warehouse> ww, IntVector2 v, ProductsSet set)
 {
     int minDst = int.MaxValue;
     Warehouse reslt = null;
     for (int i = 0; i < Warehouses.Count; i++)
     {
         if (ww[i].Set.HaveSthSimilar(set))
         {
             int dst = (int)Math.Ceiling(ww[i].Pos.Distance(v));
             if (dst < minDst)
             {
                 reslt = Warehouses[i];
                 minDst = dst;
             }
         }
     }
     return reslt;
 }
示例#4
0
 public Warehouse(int Xloc, int Yloc, int ide)
 {
     Set = new ProductsSet();
     Pos = new IntVector2(Xloc, Yloc);
     id = ide;
 }
示例#5
0
 public Warehouse(int Xloc, int Yloc, int ide)
 {
     Set = new ProductsSet();
     Pos = new IntVector2(Xloc, Yloc);
     id  = ide;
 }
示例#6
0
 public Drone(int ide)
 {
     Set = new ProductsSet();
     id  = ide;
 }
        public static Warehouse findCLosestWarehouse(List <Warehouse> ww, IntVector2 v, ProductsSet set)
        {
            int       minDst = int.MaxValue;
            Warehouse reslt  = null;

            for (int i = 0; i < Warehouses.Count; i++)
            {
                if (ww[i].Set.HaveSthSimilar(set))
                {
                    int dst = (int)Math.Ceiling(ww[i].Pos.Distance(v));
                    if (dst < minDst)
                    {
                        reslt  = Warehouses[i];
                        minDst = dst;
                    }
                }
            }
            return(reslt);
        }
示例#8
0
 public Order(int id, IntVector2 destination)
 {
     ID           = id;
     _destination = destination;
     Set          = new ProductsSet();
 }
示例#9
0
 public Drone(int ide)
 {
     Set = new ProductsSet();
     id = ide;
 }