Feurige Tomatensuppe in C# programmiert

Ich find’s nur gut. Übersichtlicher können Rezepte kaum werden. Ich hätte bitte gern auch noch einen Kochroboter, der solche Programme verarbeiten kann – oder wenigstens ein Programm, das mir den Prozess visuell und akustisch in Form einer Kochsendung darstellt.😉

Hier gefunden.

  1. namespace Kitchen

  2. {

  3. public abstract class Vessel

  4. {

  5. public List<Ingredient> Ingredients { get; protected set; }

  6. }

  7. public class Pan : Vessel

  8. {

  9. public event EventHandler HeatingComplete;

  10. public Pan()

  11. {

  12.                         Ingredients = new List<Ingredient>();

  13. }

  14. public void Stir()

  15. {}

  16. public void Heat(double Temperature)

  17. {

  18. }

  19. public void Cooldown(double Temperature)

  20. {}

  21. public bool VerifyFlavor()

  22. {

  23. return true;

  24. }

  25. }

  26. public abstract class Ingredient

  27. {

  28. protected double Amount;

  29. protected UnitType Unit;

  30. public Ingredient(double amount, UnitType unit)

  31. {

  32.                         Amount = amount;

  33.                         Unit = unit;

  34. }

  35. }

  36. public class Oil : Ingredient

  37. {

  38. public Oil(double amount, UnitType unit) : base(amount, unit){}

  39. }

  40. public class Onion : Ingredient

  41. {

  42. public Onion(double amount, UnitType unit) : base(amount, unit) { }

  43. public void Mince(){}

  44. }

  45. public class Flour : Ingredient

  46. {

  47. public Flour(double amount, UnitType unit) : base(amount, unit) { }

  48. public bool IsMaillardComplete { get; set; }

  49. }

  50. public class PeeledTomatoes : Ingredient

  51. {

  52. public PeeledTomatoes(double amount, UnitType unit) : base(amount, unit) { }

  53. }

  54. public class Broth : Ingredient

  55. {

  56. public Broth(double amount, UnitType unit) : base(amount, unit) { }

  57. }

  58. public class ItalianSeasoning : Ingredient

  59. {

  60. public ItalianSeasoning(double amount, UnitType unit) : base(amount, unit) {}

  61. }

  62. public class Sugar : Ingredient

  63. {

  64. public Sugar(double amount, UnitType unit) : base(amount, unit) {}

  65. }

  66. public class Salt : Ingredient

  67. {

  68. public Salt(double amount, UnitType unit) : base(amount, unit) {}

  69. }

  70. public class Pepper : Ingredient

  71. {

  72. public Pepper(double amount, UnitType unit) : base(amount, unit) {}

  73. }

  74. public class LemonJuice : Ingredient

  75. {

  76. public LemonJuice(double amount, UnitType unit) : base(amount, unit) {}

  77. }

  78. public class ChiliSauce : Ingredient

  79. {

  80. public ChiliSauce(double amount, UnitType unit) : base(amount, unit) {}

  81. }

  82. public enum UnitType

  83. {

  84.                 TableSpoon,

  85.                 TeaSpoon,

  86.                 Gram,

  87.                 Kilogram,

  88.                 Piece,

  89.                 Can,

  90.                 Dash,

  91.                 Drop

  92. }

  93. public class Program

  94. {

  95. public static void Run()

  96. {

  97. bool isFinished = false;

  98.                         Pan pan = new Pan();

  99.                         pan.Heat(150.0);

  100.                         Oil oil = new Oil(5, UnitType.TableSpoon);

  101.             Onion onion = new Onion(1, UnitType.Piece);

  102.                         Flour flour = new Flour(1, UnitType.TableSpoon);

  103.                         PeeledTomatoes tomatoes = new PeeledTomatoes(1, UnitType.Can);

  104.                         Broth broth = new Broth(0.25, UnitType.Kilogram);

  105.                         ItalianSeasoning seasoning = new ItalianSeasoning(1, UnitType.TeaSpoon);

  106.                         Sugar sugar = new Sugar(0.5, UnitType.TeaSpoon);

  107.                         Salt salt = new Salt(1, UnitType.Dash);

  108.                         Pepper pepper = new Pepper(1, UnitType.Dash);

  109.                         LemonJuice lemon = new LemonJuice(15, UnitType.Drop);

  110.                         ChiliSauce chili = new ChiliSauce(2, UnitType.TableSpoon);

  111.                         onion.Mince();

  112.                         pan.HeatingComplete += (sender, eventArgs) =>

  113. {

  114.                                 pan.Ingredients.Add(onion);

  115.                                 pan.Stir();

  116.                                 pan.Ingredients.Add(flour);

  117. while(!flour.IsMaillardComplete)

  118. {

  119.                                         pan.Stir();

  120. }

  121.                                 pan.Ingredients.Add(tomatoes);

  122.                                 pan.Ingredients.Add(broth);

  123.                                 pan.Ingredients.Add(seasoning);

  124.                                 pan.Cooldown(95.0);

  125. while (!pan.VerifyFlavor())

  126. {

  127.                                         pan.Ingredients.Add(sugar);

  128.                                         pan.Ingredients.Add(salt);

  129.                                         pan.Ingredients.Add(pepper);

  130. }

  131.                                 pan.Cooldown(60.0);

  132.                                 pan.Ingredients.Add(chili);

  133. };

  134. }

  135. }

  136. }


Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s