public Statistic SimulateWihFifeShips(double fullTime) { var timeScale = 0.0; var shipQueue = new ShipQueue(); var storm = new Storm(); var toWork = new ToWork(); var fifeShips = new FiveShips(); var statistic = new Statistic(4); IQuest[] quests = { shipQueue, storm, toWork, fifeShips }; shipQueue.Init(toWork); toWork.Init(shipQueue, storm, statistic, fifeShips); fifeShips.Init(shipQueue); while (timeScale < fullTime) { Array.Sort(quests); for (int i = 0; i < quests.Length; i++) { if (quests[i].EndTime > timeScale) { timeScale = quests[i].EndTime; } if (quests[i].TryMake(timeScale)) { break; } } } return(statistic); }
public void Init(ShipQueue shipQueue, Storm storm, Statistic statistic, FiveShips fifeShips) { this.shipQueue = shipQueue; this.storm = storm; this.statistic = statistic; this.fifeShips = fifeShips; }
public void Init(ShipQueue shipQueue) { this.shipQueue = shipQueue; }