public StatisticsShop MakeStatistics(int timeStamp) { StatisticsShop temp = new StatisticsShop(timeStamp, this, Stock, tempSold, tempStat); tempSold = 0; tempStat = temp; return(temp); }
} // Average sold stock I suppose. public StatisticsShop(int timeStamp, Shop me, int stock, int sold, StatisticsShop prev) : base(timeStamp) { shop = me; this.stock = stock; this.sold = sold; previous = prev; if (prev != null && false) //testing { Console.WriteLine("current id: " + ID + " previous id: " + previous.ID); Console.WriteLine("Stock: " + stock + " Sold: " + sold); Console.WriteLine("TZST: " + TotalZeroStockTime + " AStock: " + AverageStock + " ASold: " + AverageSold); Console.WriteLine("------------------------------------------------------------------------"); } }
public void CheckBestPlacement(List <int> mapBuild) { _initialMap.RemoveAllBuildings(); for (int i = 0; i < mapBuild.Count; i++) { if (mapBuild[i] != -1) { _initialMap.Locations[i].Building = _buildings[mapBuild[i]]; _initialMap.AddNewBuilding(_initialMap.Locations[i]); } } _initialMap.PrepareForSimulation(); foreach (Location l in _initialMap.Warehouses) { Warehouse w = (Warehouse)l.Building; for (int i = 1; i <= w.TotalVehiclesAtStart; i++) { Vehicle temp = new Vehicle(new System.Windows.Forms.PictureBox()); w.AddVehicle(temp); } } for (int i = 0; i <= _ticks; i++) { _initialMap.NextTick(i); } double sum = 0; foreach (Statistics item in _initialMap.Statistics) { if (item.Time == _ticks) { if (item is StatisticsShop) { StatisticsShop obj = (StatisticsShop)item; sum += obj.AverageSold; } } } if (sum > _maxSold) { _maxSold = sum; bestMap = mapBuild; } _initialMap.ResetMap(); }
public void ShopReset() { tempSold = 0; tempStat = null; stock = backupStock; }