public void Color(IEgg egg, IBunny bunny) { if (bunny.Energy > 0 && bunny.Dyes.Any(d => d.Power > 0)) { while (!egg.IsDone()) { var usedDye = bunny.Dyes.FirstOrDefault(d => d.Power > 0); if (usedDye != null) { usedDye.Use(); egg.GetColored(); } else { var HasNewDay = bunny.Dyes.Any(d => d.Power > 0); if (HasNewDay) { var newDay = bunny.Dyes.First(d => d.Power > 0); newDay.Use(); egg.GetColored(); } else { bunny.Dyes.Remove(usedDye); break; } } if (bunny.Energy < 0 || bunny.Dyes.All(d => d.Power == 0)) { break; } } } }
public void Color(IEgg egg, IBunny bunny) { IDye dye = null; while (!egg.IsDone()) { if (dye == null || dye.IsFinished()) { dye = bunny.Dyes.FirstOrDefault(d => d.Power > 0); if (dye == null) { break; } } dye.Use(); bunny.Work(); egg.GetColored(); if (bunny.Energy == 0) { break; } } }
public void Color(IEgg egg, IBunny bunny) { var dyes = bunny.Dyes; foreach (var dye in dyes) { while (!egg.IsDone()) { if (bunny.Energy > 0 && !dye.IsFinished()) { dye.Use(); bunny.Work(); egg.GetColored(); } else { break; } } if (egg.IsDone() || bunny.Energy <= 0) { break; } } }
public void Color(IEgg egg, IBunny bunny) { while (bunny.Energy > 0 && bunny.Dyes.Any()) { var dye = bunny.Dyes.FirstOrDefault(x => !x.IsFinished()); while (!dye.IsFinished() && !egg.IsDone()) { bunny.Work(); dye.Use(); egg.GetColored(); if (bunny.Energy == 0) { break; } } if (dye.IsFinished()) { bunny.Dyes.Remove(dye); } if (egg.IsDone()) { break; } } }
public void Color(IEgg egg, IBunny bunny) { foreach (var dye in bunny.Dyes) { while (!dye.IsFinished()) { if (bunny.Energy == 0) { break; } egg.GetColored(); bunny.Work(); dye.Use(); if (egg.IsDone()) { break; } } if (egg.IsDone()) { break; } } }
public void Color(IEgg egg, IBunny bunny) { bool finishColoring = false; while (!egg.IsDone() && bunny.Energy > 0 && bunny.Dyes.Any(d => !d.IsFinished())) { foreach (IDye dye in bunny.Dyes.Where(d => !d.IsFinished())) { if (finishColoring) { break; } while (true) { egg.GetColored(); dye.Use(); bunny.Work(); if (egg.IsDone() || bunny.Energy == 0) { finishColoring = true; break; } if (dye.IsFinished()) { break; } } } } }
public void Color(IEgg egg, IBunny bunny) { if (bunny.Energy > 0) { bool isThereADyes = bunny.Dyes.Any(x => x.Power > 0); bool isEggFinished = false; if (isThereADyes) { foreach (var item in bunny.Dyes.Where(x => x.Power > 0)) { while (item.Power > 0 && !isEggFinished) { item.Use(); bunny.Work(); egg.GetColored(); isEggFinished = egg.IsDone(); if (isEggFinished) { break; } } if (isEggFinished) { break; } } } } }
public void Color(IEgg egg, IBunny bunny) ///problemmm { while (egg.IsDone() == false && bunny.Energy > 0 && bunny.Dyes.Any(x => x.IsFinished() == false)) { egg.GetColored(); bunny.Work(); IDye dye = bunny.Dyes.FirstOrDefault(x => x.IsFinished() == false); dye.Use(); } }
public void Color(IEgg egg, IBunny bunny) { while (true) { if (bunny.Energy == 0) { break; } if (bunny.Dyes.All(x => x.IsFinished())) { break; } egg.GetColored(); bunny.Work(); while (bunny.Dyes.Any()) { if (bunny.Dyes.First().IsFinished() == false) { bunny.Dyes.First().Use(); break; } bunny.Dyes.Remove(bunny.Dyes.First()); } if (egg.IsDone()) { break; } } /* * while (!egg.IsDone()) * { * if (bunny.Energy == 0) * { * break; * } * * if (bunny.Dyes.All(x => x.IsFinished())) * { * break; * } * * egg.GetColored(); * bunny.Work(); ; * } * */ }
public void Color(IEgg egg, IBunny bunny) { while (bunny.Energy > 0 && bunny.Dyes.Any(d => !d.IsFinished()) && !egg.IsDone()) { var dye = bunny.Dyes.FirstOrDefault(d => !d.IsFinished()); dye.Use(); bunny.Work(); egg.GetColored(); } }
public void Color(IEgg egg, IBunny bunny) { while (bunny.Energy > 0 && bunny.Dyes.Any(d => d.Power > 0)) { if (egg.IsDone()) { break; } IDye d = bunny.Dyes.FirstOrDefault(x => x.Power > 0); d.Use(); bunny.Work(); egg.GetColored(); } }
public void Color(IEgg egg, IBunny bunny) { var dyeForColoring = bunny.Dyes.FirstOrDefault(dye => dye.Power > 0); while ((bunny.Energy > 0 && bunny.Dyes.Any(dye => dye.Power > 0)) || !egg.IsDone()) { dyeForColoring.Use(); if (dyeForColoring.Power == 0) { dyeForColoring = bunny.Dyes.FirstOrDefault(dye => dye.Power > 0); } bunny.Work(); egg.GetColored(); } }
public void Color(IEgg egg, IBunny bunny) { while (!egg.IsDone()) { if (bunny.Energy == 0) { break; } if (bunny.Dyes.All(x => x.IsFinished())) { break; } egg.GetColored(); bunny.Work(); } }
public void Color(IEgg egg, IBunny bunny) { while (bunny.Energy > 0 && bunny.Dyes.Count > 0) { var dye = bunny.Dyes.First(); egg.GetColored(); dye.Use(); bunny.Work(); if (dye.IsFinished()) { bunny.Dyes.Remove(dye); } if (egg.IsDone()) { break; } } }
public void Color(IEgg egg, IBunny bunny) { while (egg.IsDone() == false) { if (bunny.Energy == 0 || bunny.Dyes.All(x => x.IsFinished())) { break; } IDye dye = (IDye)bunny.Dyes.First(); dye.Use(); egg.GetColored(); bunny.Work(); if (dye.IsFinished()) { bunny.Dyes.Remove(dye); } } }
public void Color(IEgg egg, IBunny bunny) { while (true) { if (bunny.Energy == 0) { break; } if (bunny.Dyes.All(x => x.IsFinished() == true)) { break; } IDye currentDye = bunny.Dyes.FirstOrDefault(x => x.IsFinished() == false); while (true) { if (currentDye.IsFinished()) { break; } currentDye.Use(); bunny.Work(); egg.GetColored(); if (egg.IsDone()) { break; } } //currentDye.Use(); //bunny.Work(); //egg.GetColored(); if (egg.IsDone()) { break; } } }
public void Color(IEgg egg, IBunny bunny) { while (bunny.Energy > 0 && bunny.Dyes.Any()) { IDye currentEgg = bunny.Dyes.First(); while (!egg.IsDone() && bunny.Energy > 0 && !currentEgg.IsFinished()) { egg.GetColored(); bunny.Work(); currentEgg.Use(); } if (currentEgg.IsFinished()) { bunny.Dyes.Remove(currentEgg); } if (egg.IsDone()) { break; } } }