public HotDogCartBindings(HotDogCart cart, Grill grill, Customers customers, Time time) { _cart = cart; _grill = grill; _customers = customers; _time = time; }
/* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* -------------------------------------- UTIL FUNCTION ---------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ private void InitializeGrills(Transform planet) { Transform body; Transform faces; Collider[] colls; Grill grill; body = planet.Find("Body"); if (body == null) { Debug.LogError($"ERROR : The planet ({planet.name}) does not have a 'Body' !", planet); return; } faces = body.Find("Faces"); if (faces == null) { Debug.LogError($"ERROR : The planet's ({planet.name}) body does not have 'Faces' !", body); return; } colls = faces.GetComponentsInChildren <Collider>(); foreach (Collider c in colls) { grill = new Grill(this, c.transform); this.grills.Add(grill); } }
public void Store(List <Vector2> i, Grill tg, int[] t, AstarMoveMode m) { this.indexes = i; this.togrill = tg; this.to = t; this.mode = m; }
public int CookMenu(Menu m) { List <Grill> grillList = new List <Grill>(); List <Item> SortedList = m.items.OrderBy(o => (-o.Length * o.Width)).ToList(); //We cook all the items while (SortedList.Count != 0) { //A new grill is needed Grill g = new Grill(grillWidth, grillLength); for (int i = 0; i < grillLength; i++) { for (int j = 0; j < grillWidth; j++) { if (g.grill[j, i].Equals(g.empty)) { bool put = PutItem(ref g, ref SortedList, i, j); } } } grillList.Add(g); g.PrintGrill(g); Console.Write(Environment.NewLine + Environment.NewLine); Console.Write(Environment.NewLine + Environment.NewLine); //Delay of 1 sec for being cooked System.Threading.Thread.Sleep(1000); } ; Console.Write(Environment.NewLine + Environment.NewLine); //Number of grills needed return(grillList.Count); }
private bool ToGrill(ref Grill aux, Item i, int l0, int w0, bool horizontal) { int xAxis; int yAxis; //Put the meal horizontally if (horizontal) { xAxis = i.Length; yAxis = i.Width; } //Put the meal vertically else { xAxis = i.Width; yAxis = i.Length; } //Put the value of the meal into the grill for (int l = l0; l < l0 + yAxis; l++) { for (int w = w0; w < w0 + xAxis; w++) { if (l0 + yAxis <= grillLength && w0 + xAxis <= grillWidth && aux.grill[w, l].Equals(aux.empty)) { aux.grill[w, l] = i.Name.Substring(0, 2) + i.Quantity.ToString("D2"); } else { //Is not posible to put this meal into the grill return return(false); } } } return(true); }
private bool PutItem(ref Grill grill, ref List <Item> meat, int l0, int w0) { Grill aux = grill; foreach (Item i in meat) { //Try to put the mneal horizontally bool succeded = ToGrill(ref aux, i, l0, w0, true); //if is not posible try to put it vertically if (!succeded) { succeded = ToGrill(ref aux, i, l0, w0, false); if (!succeded) { continue; } } //If the meal is put it into the grill deduct 1 to que quantity in to the menu grill = aux; i.Quantity--; if (i.Quantity == 0) { meat.Remove(i); } return(true); } return(false); }
public Grill CreateNewGrill(Grill inGrill) { var userDao = new UserDao(); var foundUser = userDao.GetSingleUserById(inGrill.OwnerId); if (foundUser == null) { throw new KeyNotFoundException("User doesn't exist: " + inGrill.OwnerId.ToString()); } var grillCol = db.GetCollection <Grill>("Grills"); var newGrill = new Grill() { Id = Guid.NewGuid(), Brand = inGrill.Brand, Model = inGrill.Model, City = inGrill.City, Cost = inGrill.Cost, Rating = inGrill.Rating, OwnerId = inGrill.OwnerId, DeliveryFee = inGrill.DeliveryFee, }; grillCol.Insert(newGrill); return(newGrill); }
static void Main(string[] args) { var grill = new Grill(GrillLength, GrillWidth, MeatChooserStrategy, MaxRectangle); using (var client = new GrillMenuClient(new AnonymousCredentials())) { var results = client.GetAll(); grill.AddMenus(results); Console.WriteLine($"Number of menus: {results.Count}, Grill size: {grill.CurrentRound.GrillSurfaceArea}, All meat size: {grill.AllMeatsSurfaceArea}, Best fit number of rounds: {Math.Floor((decimal)grill.AllMeatsSurfaceArea / grill.CurrentRound.GrillSurfaceArea)}"); do { grill.FillCurrentRound(); Console.Write($"Round {grill.CurrentRound.RoundNumber} menus ({grill.CurrentRound.GrillSurfaceArea}/{grill.CurrentRound.GrillUsedArea}): "); grill.TimeElapsed(TimeElapsedFixedForAllMeals); var roundMenus = grill.GetFinishedMenus(); if (roundMenus.Count > 0) { foreach (var menu in roundMenus) { Console.Write($"{menu.Name},"); } } else { Console.Write("-"); } Console.WriteLine(); grill.CreateNewRound(); } while (grill.IsMenuOnWait); Console.Write("To end application press ant key..."); Console.ReadKey(); } }
private List <Step> FindPath(List <Vector2> indexes, Grill grill, int[] from, int[] to, AstarMoveMode mode, List <Step> steps = null) { List <Step> result; this.astar.FindPathNonAlloc(indexes, this.grids[grill], from, to, mode); result = this.ConvertIndexesToStepsOnGrill(indexes, grill, steps); return(result); }
public static void AddInteractions(GameObject obj) { Grill grill = obj as Grill; Stove stove = obj as Stove; Fridge fridge = obj as Fridge; Microwave micro = obj as Microwave; FoodProcessor processor = obj as FoodProcessor; if (obj != null && obj.Interactions != null) { if (fridge != null) { InteractionObjectPair i2 = new InteractionObjectPair(OverridedFridge_Have.Singleton, obj); if (!obj.Interactions.Contains(i2)) { obj.RemoveInteractionByType(Fridge_Have.Singleton); // obj.Interactions.RemoveAt(0); obj.AddInteraction(OverridedFridge_Have.Singleton); obj.AddInteraction(OverridedFridge_Prepare.PrepareSingleton); } } else if (micro != null) { InteractionObjectPair i2 = new InteractionObjectPair(OverridedMicrowave_Have.Singleton, obj); if (!obj.Interactions.Contains(i2)) { obj.AddInteraction(OverridedMicrowave_Have.Singleton); } } else if (processor != null) { InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodProcessor_Have.Singleton, obj); if (!obj.Interactions.Contains(i2)) { obj.AddInteraction(OverridedFoodProcessor_Have.Singleton); } } else if (stove != null) { InteractionObjectPair i2 = new InteractionObjectPair(OverridedStove_Have.Singleton, obj); if (!obj.Interactions.Contains(i2)) { obj.AddInteraction(OverridedStove_Have.Singleton); } } else if (grill != null) { InteractionObjectPair i2 = new InteractionObjectPair(OverridedGrill_Have.Singleton, obj); if (!obj.Interactions.Contains(i2)) { obj.AddInteraction(OverridedGrill_Have.Singleton); } } } }
public Cell SetElementOnPlanet(Transform t) { Grill g = this.GetGrillOf(t); if (g == null) { Debug.LogError("ERROR : This transform was not on this planet ! Check before using this function.\nUse 'CellableEntity.InitializeSurfaceAndCell' to avoid this error."); } return(g?.GetCellWithPosition(t.position)); }
public void Grill() { // Arrange var strategy = new Grill(); // Act var result = strategy.Cook(new Meal("Chicken")); // Assert Assert.AreEqual("Grilled Chicken", result.Name); }
private void OnTriggerEnter(Collider col) { if (col.tag.Equals("Grill")) { isOnGrill = true; if (grill == null) { grill = col.GetComponent <Grill>(); } } }
/// <summary> /// Set port value /// </summary> /// <param name="port"></param> /// <param name="restartIfStarted"></param> public static void SetPort(int port, bool restartIfStarted = true) { _port = port; if (_grill == null) { return; } if (restartIfStarted) { Grill.Restart(_port); } }
public void ExceptionTestFor_GrillNotFound() { Grill grill = new Grill() { GrillId = 1, RenterId = 1, FromDate = DateTime.Now, ToDate = DateTime.Now, }; //Assert var ex = Assert.Throws <GrillNotFoundException>(() => _Userservice.CheckAvailability(grill.GrillId, grill.RenterId, grill.FromDate, grill.ToDate)); Assert.Equal("Grill Not Found ", ex.Messages); }
private int[][] GetIndexesTransitionBetweenGrills(Grill g1, Grill g2) { // not yet implemented return(null); /*int[][] result; * * result = new int[][] * { * new int[2] {0, 0}, * new int[2] {0, 0} * }; * * return result;*/ }
public string GetValue(string selectedSetting) { MicrowaveSettings setting = (MicrowaveSettings)Enum.Parse(typeof(MicrowaveSettings), selectedSetting, true); switch (setting) { case MicrowaveSettings.Power: return(Power.ToString()); case MicrowaveSettings.Grill: return(Grill.ToString()); default: return(""); } }
public Grill EditExistingGrill(Guid grillId, Grill updateGrill) { var grillcol = db.GetCollection <Grill>("Grills"); var foundGrill = grillcol.FindById(grillId); if (!string.IsNullOrWhiteSpace(updateGrill.Brand)) { foundGrill.Brand = updateGrill.Brand; } if (!string.IsNullOrWhiteSpace(updateGrill.Model)) { foundGrill.Model = updateGrill.Model; } if (!string.IsNullOrWhiteSpace(updateGrill.City)) { foundGrill.City = updateGrill.City; } if (updateGrill.Cost != foundGrill.Cost) { if (updateGrill.Cost != 0) { foundGrill.Cost = updateGrill.Cost; } } if (updateGrill.Rating != foundGrill.Rating) { if (updateGrill.Rating != 0) { foundGrill.Rating = updateGrill.Rating; } } if (updateGrill.DeliveryFee != foundGrill.DeliveryFee) { if (updateGrill.DeliveryFee != 0) { foundGrill.DeliveryFee = updateGrill.DeliveryFee; } } grillcol.Update(foundGrill); return(foundGrill); }
private void UpdateGridOf(Grill g) { int[,] ins; Cell[,] cs; int gheight, gwidth; cs = this.cells[g]; ins = this.grids[g]; gheight = cs.GetLength(0); gwidth = cs.GetLength(1); for (int w = 0; w < gwidth; ++w) { for (int h = 0; h < gheight; ++h) { ins[h, w] = (cs[h, w].isWalkable) ? 0 : 1; } } }
/// <summary>Plans the given menu.</summary> /// <param name="menu">The menu to be planned for grilling.</param> /// <returns>The plan for the grilling.</returns> /// <remarks>This method plans the grilling of the menu.</remarks> public override GrillMenuGrillingPlan Plan(GrillMenuModel menu) { var plan = new GrillMenuGrillingPlan(); var grill = new Grill(GrillConfiguration); // Convert given GrillMenuModel instance into Dictionary<GrillItem, int> Dictionary <GrillItem, int> newMenu = ValidateAndCreateMenu(menu); while (true) { var newMenuItems = (from newMenuItem in newMenu.Keys where newMenu[newMenuItem] != 0 select newMenuItem).ToArray(); // Loop will continue if there are items to be added; otherwise, it will break if (!newMenuItems.Any()) { break; } TimeSpan maxTimeSpan = new TimeSpan(0, 0, 0); // Iterate on items with quantity > 0 and add them to to grill foreach (var grillItem in newMenuItems) { int addedCount = grill.AddMenuItem(grillItem, newMenu[grillItem]); // We may not be able to place every item since grill size is limited. newMenu[grillItem] -= addedCount; if (grillItem.CookingTime > maxTimeSpan) { maxTimeSpan = grillItem.CookingTime; } } // Apply the results to the plan. plan.Rounds++; plan.ElapsedTime += (uint)maxTimeSpan.TotalSeconds; // Clear the grill for the new round. grill.Clear(); } return(plan); }
// Start is called before the first frame update void Start() { if (!scoreText) { scoreText = GameObject.Find("ScoreText").GetComponent <Text>(); } if (!timerText) { timerText = GameObject.Find("TimerText").GetComponent <Text>(); } if (!endOfGameText) { endOfGameText = GameObject.Find("EndGameText").GetComponent <Text>(); } endOfGameUI.SetActive(false); grillScript = GameObject.FindObjectOfType <Grill>(); }
/* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* ---------------------------- UTIL FUNCTION NOT YET IMPLEMENTED -----------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ private List <Step> FindPathAmongGrill(List <Vector2> indexes, Grill fromgrill, Grill togrill, int[] from, int[] to, AstarMoveMode mode) { // not yet implemented return(null); /*List<Grill> grills; * List<Step> steps; * int[][] mids; * Grill g; * int count; * * steps = new List<Step>(); * * grills = this.surface.GetPathAmongGrill(fromgrill, togrill); * count = grills.Count; * * mids = this.GetIndexesTransitionBetweenGrills(fromgrill, grills[1]); * this.astar.FindPathNonAlloc(indexes, this.grids[fromgrill], from, mids[0], mode); * this.ConvertIndexesToStepsAmongGrill(steps, indexes, fromgrill); * * for(int i = 1; i < count - 1; ++i) { * g = grills[i]; * mids = this.GetIndexesTransitionBetweenGrills(g, grills[i+1]); * this.astar.FindPathNonAlloc(indexes, this.grids[g], mids[0], mids[1], mode); * this.ConvertIndexesToStepsAmongGrill(steps, indexes, g); * } * * mids = this.GetIndexesTransitionBetweenGrills(grills[count-2], togrill); * this.astar.FindPathNonAlloc(indexes, this.grids[togrill], mids[1], to, mode); * this.ConvertIndexesToStepsAmongGrill(steps, indexes, togrill); * * return steps;*/ }
private List <Step> ConvertIndexesToStepsOnGrill(List <Vector2> indexes, Grill g, List <Step> steps) { int gheight; Cell c; gheight = g.height; if (steps == null) { steps = new List <Step>(); } else { steps.Clear(); } foreach (Vector2 index in indexes) { c = g.cells[Mathf.RoundToInt(index[1] + index[0] * gheight)]; steps.Add(new Step(c.position, c.normal)); } return(steps); }
public bool AddGrill(Grill grillber) { return(true); }
public bool UpdateGrill(Grill grillber) { return(true); }
private void Start() { _audioSource = GetComponent <AudioSource>(); _grill = GetComponent <Grill>(); }
public GrillBindings(Grill grill, Time time, HotDogCart cart) { _grill = grill; _time = time; _cart = cart; }
public Grill AddNewGrill(Grill inGrill) { var grillDao = new GrillDao(); return(grillDao.CreateNewGrill(inGrill)); }
public Grill EditGrill(Guid grillId, Grill updateGrill) { var grillDao = new GrillDao(); return(grillDao.EditExistingGrill(grillId, updateGrill)); }
public Grill GetGrillsById(int grillid) { Grill grill = new Grill(); return(grill); }