Cooking in code challenge - Chocolate cake in a cup
Thought I would try and start a bit of programming fun.
The challenge is to write a cooking recipe in code. It does not need to compile as long as it is valid syntax for your chosen language.
To get the ball rolling. Here is 5 minute chocolate in a cup recipe in C#.
public IContainer Prepare()
{
var flour = Ingredients.Get(4, Tablespoon, SelfRaisingFlour);
var sugar = Ingredients.Get(4, Tablespoon, Sugar);
var cocoa = Ingredients.Get(2, Tablespoon, CocoaPowder);
var egg = Ingredients.Get(Egg);
var milk = Ingredients.Get(3, Tablespoon, Milk);
var oil = Ingredients.Get(3, Tablespoon, CanolaOil);
var mug = Containers.Get(LargeMug);
mug.Contents
.Add(new[] {flour, sugar, cocoa})
.Mix(EvenDistribution)
.Add(new[] {egg, milk, oil})
.Mix(SmoothPaste);
return Microwave
.AddMicrowaveSafeContainer(mug)
.Cook(Power.Full, Minute * 3)
.RemoveContainer();
}
If you post your own make sure you put "cookingincode" in the tags :)
Happy coding
Woz
