21
\$\begingroup\$

I hear somebody was very selfish on their birthday, demanding cake from everyone and there were no plans to share! 🎂

It's bound to be somebody's birthday today, so why not bake them a cake. Use your favourite programming language to make a delicious cake, with a nice "Happy Birthday" message as the output. (Might I suggest Chef!)

Your cake should

  • Mimic a real world recipe (if you can link to it, brilliant!)
    • a list of newline separated ingredients suitable for making a cake
    • a newline separated list of steps for the method
    • how many people it serves
  • Stay as close to correct ingredient ratios as possible.
  • Output minimally "Happy Birthday" when served.

The best cakes will be:

  • Delicious - since this is a , the community will decide what is delicious
  • Personalised - try baking a custom happy birthday message to somebody specific. (If you can't find a PPGC user, why not a celebrity?)
  • Balanced - Try to use a suitable number of ingredients for the amount of servings the recipe prepares. 1000 eggs, serves 1 for one serving is probably just a teensy bit big, huge,

    absolutely colossal!

  • Outlandish - You can bake more than just a basic sponge, for example, include some icing, a drizzle, serve with sauce, decorations, etc.
  • Visually appealing - images are good either in the source code as ascii or in the output. The first "byte" is with the eyes after all.

And don't forget, good bakers don't cut corners and do things properly. (Don't just use no-op code to make it look like a recipe then print, make sure your code means something) I encourage voters to view these recipes negatively.

Happy Baking!

enter image description here

\$\endgroup\$
9
  • 3
    \$\begingroup\$ Hey, in my defence, I thought you were all going to get me some! \$\endgroup\$
    – Beta Decay
    Sep 11, 2015 at 16:02
  • \$\begingroup\$ Is it any consolation that I was concerned that you'd be upset? \$\endgroup\$ Sep 11, 2015 at 16:53
  • \$\begingroup\$ Nah it's fine, I'm just kidding ;) \$\endgroup\$
    – Beta Decay
    Sep 11, 2015 at 16:54
  • \$\begingroup\$ Maybe it should have been also underhanded? \$\endgroup\$
    – Vi.
    Sep 13, 2015 at 22:13
  • 2
    \$\begingroup\$ I’m voting to close this question because it lacks an "objective validity criterion" as required by the popularity-contest tag wiki. \$\endgroup\$ Feb 10 at 2:09

6 Answers 6

22
\$\begingroup\$

ECMAScript 2015, serves 10

Don  =([_])=> alert(_.replace(/^.*(?=, )/,'Happy Birthday'))

ReadMoreAbout  =classic=  victoria  =sandwich=  on  =bbcgoodfood=      ~`

⚠  Remember that OCR technologies aren't perfect, and that scanning old,
⚠  smudgy recipes does not always go as smoothly as we'd expect or hope.
⚠  This recipe is not wonderful, but please, thoroughly enjoy making it.

`

try/* to do this properly! */{
  // Link to recipe:
  bbcgoodfood.com/recipes/1997/classic-victoria-sandwich
  'Makes 10 slices'

  Ingredients:
    ForThecake:
      - 200 | grammes | castorSugar
      - 200 | grammes | softenedButter
      -   4 | whole   | eggs
      - 200 | grammes | self-raising_flour
      -   1 | tsp     | bakingPowder
      -   2 | tbsp    | milk

    For_theFilling:
      -  100 | grammes | butter, softened
      -  140 | grammes | icing.sugar, sifted
      -    a | drop    | vanilla- extract (optional)
      -  240 | grammes | jar.good-quality_strawberryJam
      -                  icingSugar, to.decorate

  Method:
    1. ^`Heat oven to 190C/fan 170C/gas 5. Butter two 20cm sandwich tins
         and line with non-stick baking paper. In a large bowl,
         beat all the cake ingredients together until you have a smooth, soft batter.`
    2. ^`Divide the mixture between the tins, smooth the surface with a spatula
         or the back of a spoon, then bake for about 20 mins until golden
         and the cake springs back when pressed. Turn onto a cooling rack
         and leave to cool completely.`
    3. ^`To make the filling, beat the butter until smooth and creamy,
         then gradually beat in icing sugar. Beat in vanilla extract if you’re
         using it. Spread the butter cream over the bottom of one of the sponges,
         top it with jam and sandwich the second sponge on top.
         Dust with a little icing sugar before serving.
         Keep in an airtight container and eat within 2 days.`

  * HappyBirthdayǃ
} catch (cake) {
  Don`t drop that! It's your cake, Uncle Chris! This cake is one day late – sorry about that.
`}

Valid ES6 code; no corners cut!

It works in Firefox Developer Edition.

It is all valid code; the try only serves to catch the ReferenceError caused by the variables not being defined.

\$\endgroup\$
3
  • \$\begingroup\$ This is a good answer. This is what I was looking for. 😆 \$\endgroup\$ Sep 11, 2015 at 17:43
  • 5
    \$\begingroup\$ Clearly ⚠ should become a valid comment character in ECMAScript 7. \$\endgroup\$
    – user253751
    Sep 13, 2015 at 2:45
  • \$\begingroup\$ @immibis Yeah, definitely :-) \$\endgroup\$
    – Toothbrush
    Sep 13, 2015 at 19:25
22
\$\begingroup\$

BF

Inspired by mbomb007s answer, I've made them a cake.

I'm afraid I lost the recipe (it's around here somewhere, but I'd probably have to break my own rules on cutting corners to post it); here is the finished product.

                                    +
                                    [
                       (
               )                    )             (
                       )           (o)    )
               (      (o)    )     ,|,            )
              (o)     ,|,          |~\    (      (o)
              ,|,     |~\    (     \ |   (o)     ,|,
              \~|     \ |----(o)->++|+\<]>,|,     |+.
              |`\-----|`\@@@-|-@@@@\.-@@@\~|[++>-\ |-
             -\-|-o@@@\ |@@@<]>@@@@|.\@@@|.\@@@o+|+\++
            ++|+\@@@@@|+\@@@|+\@@@@\.|@@@\-[@@@@@\-|o-- 
           ->@\+|@@@@@\<|@@@]>|@@@@@@@@@@|+\@@@@@|+\@@o.
          [->+|+\+@@@@@@@@@@|<]@@@@@@@@@@\>|@@@@@\+|+@@@.
          +@@@@@@@@@@@@@@@@@\+|@@@@@@@@@@|+\@@@@@@@@++++.
          @@++@@@@@@@@@@@@@@|+\@@@@@@@@@@@@@@@@@@@@+++++
          +.@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@o@@.-@
          --@@--@@-@@@@@@@@@@@@@@@@@@@@@@@@@@@@-@@-@@--@
          --@@.-@@@@---.@@@@--@@@@@-.+[@@@@@o---@@@>+<:]
          >::::::+::::::++@@.::@@@:::::@@@@:::::@@:::::%
          %%::::::::::::@@::::::@:::::::@@::::::::::::%%
          ::%%%::::::::::@::::::::::::::@::::::::::%%%::
       º# ::%::%%%%%%:::::::::::::::::::::::::%%%%%::%::##º
     º### ::::::%%:::%:%%%%%%%%%%%%%%%%%%%%%:%:::%%::::: ###º
   º##### ::::::%:::::%%::::::%%%%:::::%%::::%:::::::::: #####º
  º###### `:::::::::::%:::::::%:::::::::%::::%:::::::::' ######º
 º########  ``::::::::::::::::::::::::::::::::::::''  #########º
  º##########   ```::::::::::::::::::::::::::'''   ###########º'
    `º#########-[---->+<]>++.[-->+++<]>..+++++++. ###########º'
      ` º#################################################º '
          ` º#######################################º '
             ` º#################################º '
                   ` º######################º '

Outputs:

happy birthday 007

So conveniently it works for James Bond, but not until 11th November.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Woah........... nice! \$\endgroup\$
    – mbomb007
    Sep 11, 2015 at 15:30
  • \$\begingroup\$ Is it clean Brainfuck? It doesn't seem to work for me... \$\endgroup\$
    – RedClover
    Sep 28, 2017 at 14:12
16
\$\begingroup\$

Python 2, serves 0

First of all, sorry, this isn't a REAL world cake.

However, it is in one of the best games of all time, Portal.

This recipe is based on what the Intelligence Core says are the ingredients.

""" Happy Birthday, Chell!
* * * * * * * * * * * """
# Here are all the ingrediants for portal cake
candles = 1 # There is most certainly only one candle for her.
fish_shaped_dirt = 32 # There isn't an official amount of dirt to add, 32 seems like a nice number.

#Full of lies
lie = float('inf')

serves = None

# Show the tester the documentation on how to use this
print __doc__,

# Now, we are going to repeat these steps until chell stops lying.
while lie:
    # She did it again, so now we need to do the whole thing once more.
    print "\r",
    # Check how many candles her cake will have
    if candles:
        # We had better take them away from her. Maybe it will stop her lying so much
        candles = 0
    else:
        # Maybe if we give her a candle, she will listen
        candles = 1
    # See, her chances of lying go down when we give her candles!
    lie -= candles
    # Add the fish shaped dirt. But ONLY if we're giving her a candle.
    print chr(fish_shaped_dirt)*candles,
    # Add all the other rubbish
    print __doc__[25:],
    #Flush it into the relaxation vault
    import sys
    sys.stdout.flush()
    # Wait and ask her if she liked it.
    import time
    time.sleep(1)

Output

 Happy Birthday, Chell!
 * * * * * * * * * * *

Followed by

 Happy Birthday, Chell!
  * * * * * * * * * * *

Then repeats indefinitely

\$\endgroup\$
6
  • 8
    \$\begingroup\$ The cake is a lie. \$\endgroup\$
    – orlp
    Sep 11, 2015 at 12:12
  • 1
    \$\begingroup\$ I want to up vote because I love Portal, but by my own criteria I can't! Even if I could eat a cake that wasn't a lie, it would taste awful. Dirt doesn't make for good eating! \$\endgroup\$ Sep 11, 2015 at 12:15
  • 6
    \$\begingroup\$ This is a triumph. \$\endgroup\$
    – James
    Sep 11, 2015 at 12:27
  • 1
    \$\begingroup\$ You didn't even use the best ingredients. 1 rhuBARB on fire, fish-shaped crackers, a book on how to kill someone with your bare hands, etc. \$\endgroup\$
    – mbomb007
    Sep 11, 2015 at 14:01
  • \$\begingroup\$ It serves 0. You can never make enough of it to make a serving. Therefore, you will have to listen to me when I say this it tastes great \$\endgroup\$
    – Blue
    Sep 11, 2015 at 16:18
16
\$\begingroup\$

Brainf***

I like ice cream cake, which doesn't require baking. Also, it's my birthday, so don't tell me what kind of cake I can have.

Buy an ice cream cake:
    +   +   +    +   +   +
    |   |   |    |   |   |
[-]-[------->+<]>-.[--->++++<]
|><>+.-[++>-----<]>..+++++++++
|><.-[---->+<]>++.+[->++<]>.-[
|><--->+<]>--.+++++++++.++.---
|><---------.----.---.+[--->+<
|><]>+++.-[---->+<]>+++---+++|
then serve it.

I like to pretend that the >+<]>'s are fish-shaped crackers.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ I think this is worthy of a +1 for matching 4/5 "best cake" criteria. I'll give you the vote, but definitely cut corners by just buying the cake. 😞 \$\endgroup\$ Sep 11, 2015 at 13:58
  • \$\begingroup\$ I also could've personalized it, but that would make the cake twice as big. It also just didn't look as great. \$\endgroup\$
    – mbomb007
    Sep 11, 2015 at 14:03
  • \$\begingroup\$ I'm currently having a go at making the cake look more extravagant :P \$\endgroup\$ Sep 11, 2015 at 14:03
  • \$\begingroup\$ I made you a cake. \$\endgroup\$ Sep 11, 2015 at 14:58
  • \$\begingroup\$ @mikeTheLiar I guess you haven't played Portal or read the recipe recently? Read it again: theportalwiki.com/wiki/Core_voice_lines#Cake_core \$\endgroup\$
    – mbomb007
    Sep 11, 2015 at 15:29
8
\$\begingroup\$

Pip, serves 2

For those of us whose birthday tastes are a little more global...

Our dessert tonight: " Birthday " Dosa!
(adapted from vegrecipesofindia.com/masala-dosa-recipe-how-to-make-masala-dosa-recipe)

1 cup rice: ("mmm, rice")
1 cup ukda chawal: [don't know what that is but it sounds good]
1/2 cup urad dal: ["dal" means lentils in Hindi]
1/4 cup poha: ["poha" is another kind of rice]
1/4 tsp methi seeds: ("!")
salt to taste: ["Happy" time]
water as needed: [you'll need some water]

Are you ready to cook? Yes? OK then:

1. rinse the rice and urad dal separately first.:
2. soak the ukda chawal, rice and poha.
3. in another bowl soak the urad dal-methi in enough water.
4. grind the urad dal with methi to a fine and fluffy batter.
5. grind the rice and poha to a smooth batter.
6. mix both the rice and urad dal batter with salt.
7. cover and let the batter ferment for 8-9 hours.

is it Ready? Y(es) or N(o)

Answer should be: y.
    take batter out and:

1. heat a flat cast-iron griddle and smear some oil on it.
3. spread the dosa batter in a circular way on the griddle; add some oil on top.
4. flip and cook the other side.
5. serve dosa hot with coconut chutney and sambar. (yum)

Recipe serves ___:
           `(?<=2) ?`
Actually, it serves exactly 2--half feR "ME" and half feR:_" YOU"!
Yeah! Happy birthday  !

Output

Happy Birthday 2 YOU!

or, if you cook it:

Birthday Dosa

Now I'm hungry.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Dosa in a cooking-related challenge? That sounds familiar... ;-) \$\endgroup\$ Sep 13, 2015 at 11:43
  • \$\begingroup\$ +1 for "Now I'm hungry." Thanks a lot, I'm hungry now too. \$\endgroup\$
    – clapp
    Oct 4, 2015 at 23:53
  • \$\begingroup\$ For the record I also have no idea what ukda chawal is. \$\endgroup\$
    – Alex A.
    Nov 5, 2015 at 4:42
2
\$\begingroup\$

Chef, serves 16.

Based off of this. I couldn't find an interpreter online, so I closely followed the specs found here.

"Golfed" version

"Happy" Birthday Cake.

This recipe was recovered from an *erm* ANCIENT cave, in which the culture consumed enormous amounts of eggs and water, and did so through their caves. Modern ingredients have been added in an endevour to make the cake better.

Ingredients.
48 teaspoons 2% milk
1 cup butter
1 l semisweet chocolate
73 eggs
2 teaspoons vanilla extract
1 cup sugar
1 teaspoon baking soda
5 teaspoons salt
24 g happiness
3 teaspoons water
8 ml corn starch
32 g space

Cooking time: 25 minutes.

Pre-heat oven to 162 degrees Celsius.

Method.
Put 2% milk into the mixing bowl. Add happiness to the mixing bowl. Put eggs into the mixing bowl. Add happiness to the mixing bowl. Put vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine salt into mixing bowl. Add happiness to the mixing bowl. Add corn starch to the mixing bowl. Put vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine salt into mixing bowl. Add happiness to the mixing bowl. Add corn starch to the mixing bowl. Put 2% milk into the mixing bowl. Add happiness to the mixing bowl. Add happiness to the mixing bowl. Add happiness to the mixing bowl. Add sugar to the mixing bowl. Put space into mixing bowl. Put happiness into the mixing bowl. Remove water from the mixing bowl. Combine vanilla extract into the mixing bowl. Add happiness to the mixing bowl. Put vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine salt into mixing bowl. Add butter to the mixing bowl. Add happiness to the mixing bowl. Put space into the mixing bowl. Combine water into the mixing bowl. Remove water from mixing bowl. Remove water from mixing bowl. Add happiness to the bowl. Put space into the mixing bowl. Combine water into the mixing bowl. Remove water from mixing bowl. Remove semisweet chocolate from mixing bowl. Add happiness to the bowl. Put vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine salt into mixing bowl. Add happiness to the bowl. Put 2% milk into the mixing bowl. Add happiness to the mixing bowl. Add happiness to the mixing bowl. Add sugar to the mixing bowl. Put eggs into the mixing bowl. Add happiness to the mixing bowl. Put eggs in mixing bowl. Add happiness to the mixing bowl. Add happiness to the mixing bowl. Put happiness into the mixing bowl. Put happiness into the mixing bowl. Remove sugar from the bowl. Remove baking soda from the bowl. Put space into mixing bowl. Put vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine vanilla extract into the mixing bowl. Combine salt into mixing bowl. Add happiness to the mixing bowl. Add salt to the mixing bowl. Put eggs into the mixing bowl. Add happiness to the mixing bowl. Add butter to the mixing bowl. Add water to the mixing bowl. Put space into the mixing bowl. Add baking soda to the mixing bowl. Liquefy contents of the mixing bowl. Serves 16.

Output: Happy Birthday, me!.

Here is the explanation for each step:

"Happy" Birthday Cake.

This recipe was recovered from an *erm* ANCIENT cave, in which the culture consumed enormous amounts of eggs and water, and did so through their caves. Modern ingredients have been added in an endevour to make the cake better.

Ingredients.
48 teaspoons 2% milk
1 cup butter
1 l semisweet chocolate
73 eggs
2 teaspoons vanilla extract
1 cup sugar
1 teaspoon baking soda
5 teaspoons salt
24 g happiness
3 teaspoons water
8 ml corn starch
32 g space

Cooking time: 25 minutes.

Pre-heat oven to 162 degrees Celsius.

Method.

Put 2% milk into the mixing bowl.               48
Add happiness to the mixing bowl.                +24= 72 (H)

Put eggs into the mixing bowl.                  73
Add happiness to the mixing bowl.                +24= 97 (a)

Put vanilla extract into the mixing bowl.       2
Combine vanilla extract into the mixing bowl.   *2 = 4
Combine vanilla extract into the mixing bowl.   *2 = 16
Combine salt into mixing bowl.                  *5 = 80
Add happiness to the mixing bowl.                +24=104
Add corn starch to the mixing bowl.             +8 =112 (p)

Put vanilla extract into the mixing bowl.       2
Combine vanilla extract into the mixing bowl.   *2 = 4
Combine vanilla extract into the mixing bowl.   *2 = 16
Combine salt into mixing bowl.                  *5 = 80
Add happiness to the mixing bowl.                +24=104
Add corn starch to the mixing bowl.             +8 =112 (p)

Put 2% milk into the mixing bowl.               48
Add happiness to the mixing bowl.                +24= 72
Add happiness to the mixing bowl.                +24= 96
Add happiness to the mixing bowl.                +24=120
Add sugar to the mixing bowl.                   +1 =121 (y)

Put space into mixing bowl.                     32      ( )

Put happiness into the mixing bowl.              24
Remove water from the mixing bowl.              -3 = 21
Combine vanilla extract into the mixing bowl.   *2 = 42
Add happiness to the mixing bowl.                +24= 66 (B)
Put vanilla extract into the mixing bowl.       2
Combine vanilla extract into the mixing bowl.   *2 = 4
Combine vanilla extract into the mixing bowl.   *2 = 16
Combine salt into mixing bowl.                  *5 = 80
Add butter to the mixing bowl.                  +1 = 81
Add happiness to the mixing bowl.                +24= 95 (i)

Put space into the mixing bowl.                 32
Combine water into the mixing bowl.             *3 = 96
Remove water from mixing bowl.                  -3 = 93
Remove water from mixing bowl.                  -3 = 90
Add happiness to the bowl.                      +24=114 (r)

Put space into the mixing bowl.                 32
Combine water into the mixing bowl.             *3 = 96
Remove water from mixing bowl.                  -3 = 93
Remove semisweet chocolate from mixing bowl.    -1 = 92
Add happiness to the bowl.                      +24=116 (t)

Put vanilla extract into the mixing bowl.       2
Combine vanilla extract into the mixing bowl.   *2 = 4
Combine vanilla extract into the mixing bowl.   *2 = 16
Combine salt into mixing bowl.                  *5 = 80
Add happiness to the bowl.                       +24=104 (h)

Put 2% milk into the mixing bowl.               48
Add happiness to the mixing bowl.                +24= 72
Add happiness to the mixing bowl.                +24= 96
Add sugar to the mixing bowl.                   +1 = 97 (d)

Put eggs into the mixing bowl.                  73
Add happiness to the mixing bowl.                +24= 97 (a)

Put eggs in mixing bowl.                        73
Add happiness to the mixing bowl.                +24 = 97
Add happiness to the mixing bowl.                +24 =121(y)

Put happiness into the mixing bowl.              24
Put happiness into the mixing bowl.              +24= 48
Remove sugar from the bowl.                     -3 = 45
Remove baking soda from the bowl.               -1 = 44 (,)

Put space into mixing bowl.                     32      ( )

Put vanilla extract into the mixing bowl.       2
Combine vanilla extract into the mixing bowl.   *2 = 4
Combine vanilla extract into the mixing bowl.   *2 = 16
Combine salt into mixing bowl.                  *5 = 80
Add happiness to the mixing bowl.                +24=104
Add salt to the mixing bowl.                    +5 =109 (m)

Put eggs into the mixing bowl.                  73
Add happiness to the mixing bowl.                +24=97
Add butter to the mixing bowl.                  +1 =98
Add water to the mixing bowl.                   +3 =101 (e)

Put space into the mixing bowl.                 32
Add baking soda to the mixing bowl.             +1 = 33 (!)

Liquefy contents of the mixing bowl.            Converts the mixing bowl to characters

Serves 16.                                      Outputs the contents of the first
                                                16 bowls.
\$\endgroup\$
6
  • \$\begingroup\$ Isn't it spelled "happiness," or do names need to be a specific way? \$\endgroup\$
    – cole
    Oct 4, 2015 at 23:11
  • \$\begingroup\$ Sorry, wrote in my code-pad. I forgot I had turned off auto-correct. \$\endgroup\$ Oct 4, 2015 at 23:25
  • \$\begingroup\$ I also haven't run this yet, but I think you've got everything in 1 mixing bowl, then attempt to output 16. \$\endgroup\$ Oct 5, 2015 at 7:36
  • \$\begingroup\$ @JamesWebster The spec says that the Serves N statement outputs all the ingredients in each bowl from 1 to N. \$\endgroup\$ Oct 5, 2015 at 10:52
  • \$\begingroup\$ Yeah, but you have only used one bowl. Bowls 2-15 are empty / don't exist. \$\endgroup\$ Oct 5, 2015 at 11:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.