131
\$\begingroup\$

Your favourite programming language has just had a birthday. Be nice and sing it the Happy Birthday song.

Of course you should accomplish this by writing a program in that language. The program takes no input, and writes the following text to the standard output or an arbitrary file:

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear [your favourite programming language]
Happy Birthday to You

You should substitute the bracketed part (and omit the brackets).

This is a code golf — shortest code wins.

UPDATE

I'm glad that the question aroused great interest. Let me add some extra info about scoring. As stated originally, this question is a code golf, so the shortest code is going to win. The winner will be picked at the end of this week (19th October).

However, I'm also rewarding other witty submissions with up-votes (and I encourage everybody to do so as well). Therefore although this is a code-golf contest, not-so-short answers are also welcome.

Results

Congratulations to Optimizer, the winner of this contest with his 42 byte long, CJam submission.

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 39752; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/<a/.test(lang)) lang = jQuery(lang).text();
    
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang > b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
16
  • 4
    \$\begingroup\$ Can we count the name of the programming language as one byte because it would only seem fair to people coding in a long-winded language such as JavaScript vs. someone doing it in C. We are really looking for most creative logic right? \$\endgroup\$
    – MonkeyZeus
    Commented Oct 13, 2014 at 18:49
  • 16
    \$\begingroup\$ Why all the upvotes for this despite all the downvotes for the Bonbon song? This is just as boring a challenge. \$\endgroup\$
    – xnor
    Commented Oct 14, 2014 at 7:15
  • 10
    \$\begingroup\$ I should probably mention that the song is copyrighted and distributing these programs may cause a DMCA \$\endgroup\$ Commented Oct 14, 2014 at 14:38
  • 13
    \$\begingroup\$ guys! Happy Birthday song is now in public domain!! \$\endgroup\$
    – Optimizer
    Commented Sep 23, 2015 at 10:01
  • 5
    \$\begingroup\$ At least one of the answers prints a leading newline. Is that allowed? \$\endgroup\$
    – Dennis
    Commented Jun 19, 2016 at 21:32

211 Answers 211

1
4
5
6 7 8
1
\$\begingroup\$

JMP/JSL, 67

Like the Mathematica example by David Carraher, this will 'sing' (...read) the Happy Birthday message to you out loud.

speak(x="\!nHappy Birthday";y=x||" to You";y||y||x||" Dear JSL"||y)

Output:

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear JSL
Happy Birthday to You

For 7 less bytes you will have the Happy Birthday message printed for you in the log

\$\endgroup\$
1
\$\begingroup\$

SAS, 66 bytes

data;a='Happy Birthday';b=a||' to You';put b/b/a 'Dear SAS'/b;run;
\$\endgroup\$
1
\$\begingroup\$

Lua - 72 bytes

Straightforward, but none of the other Lua programs work this way.

a,b,c='Happy Birthday ','to You\n','Dear Lua\n'io.write(a,b,a,b,a,c,a,b)
\$\endgroup\$
1
\$\begingroup\$

><>, 157

v
\0&
v                                   <
\&:&2(?v
       >"Happy Birthday to you"a&1+&^
\"Happy Birthday dear ><>"a\
v  a"uoy ot yadhtriB yppaH"/
r
>l?!;o

Big, but I wanted it to be different from the Befunge answer.

\$\endgroup\$
1
\$\begingroup\$

G*, 76 bytes

G* is a golfing language I made but it seems it failed miserably :P (Note that this isn't even close to my favorite language but I wanted to give it a try at code golf.)

l 2 p Happy birthday to you;p Happy birthday dear G*;p Happy birthday to you

Here's another (longer) one:

1=Happy birthday to you;@ 1;@ 1;p Happy birthday dear G*;p Happy birthday to you
\$\endgroup\$
1
\$\begingroup\$

C#, 91 bytes

var s="Happy Birthday to You\n";System.Console.Write(s+s+s.Substring(0, 15)+"Dear C#\n"+s);
\$\endgroup\$
1
\$\begingroup\$

Milky Way 1.6.5, 56 bytes

I"Happy Birthday ":"Dear Milky Way"+;"to You"+::>>J§{!}

Explanation

I                                                        ` empty the stack
 "Happy Birthday "                                       ` push the string
                  :"Dear Milky Way"+                     ` make the 3rd line
                                    ;"to You"+::         ` make the 1st, 2nd and 4th lines
                                                >>       ` put the lines in order
                                                  J§{!}  ` print each line

Usage

$ ./mw <path-to-code>
\$\endgroup\$
1
\$\begingroup\$

F#, 76 bytes

for i=0 to 3 do printfn"Happy Birthday %s"<|if i=2 then"Dear F#"else"to You"
\$\endgroup\$
1
\$\begingroup\$

Pushy, 44 bytes

Pushy doesn't actually have a string type. However, it has the command ", which interprets the current stack as a character list and prints it.

`Happy Birthday `V`to You`""F`dear Pushy`"F"

It's quite simple:

`Happy Birthday `      % Push chars
V                      % Copy into stack 2
`to You`               % Push chars
""                     % Print stack 1 twice ("Happy Birthday to You")
F                      % Go to stack 2
`dear Pushy`           % Push chars
"                      % Print stack ("Happy Birthday dear Pushy")
F"                     % Print other stack again to complete the song.

Basically, it uses the two stacks to construct the two needed strings, and prints them as it goes along. Here's the output:

$ pushy happybday.pshy

Happy Birthday to You
Happy Birthday to You
Happy Birthday dear Pushy
Happy Birthday to You
\$\endgroup\$
1
\$\begingroup\$

ZPL (Zebra Programming Language), 112 bytes

This is a just for fun answer.

^XA^FB137,4^FDHappy Birthday to You\&Happy Birthday to You\&Happy Birthday Dear ZPL\&Happy Birthday to You^FS^XZ

Try It Online

Explanation:

^XA                                # Start Format
    ^FB                            # Field Block
        137,                       # Width of text block line (in dots)
        4                          # Maximum number of lines in text block
    ^FD                            # Field Data
        Happy Birthday to You      # Hardcoded String
        \&                         # New Line (as allowed by the ^FB command)
        Happy Birthday to You      # Hardcoded String
        \&                         # New Line (as allowed by the ^FB command)
        Happy Birthday Dear ZPL    # Hardcoded String
        \&                         # New Line (as allowed by the ^FB command)
        Happy Birthday to You      # Hardcoded String
    ^FS                            # Field Separator
^XZ                                # End Format

Note: The Zebra Programming Language is a printer control language that is not Turing complete.

\$\endgroup\$
1
\$\begingroup\$

PHP, 68 65 bytes

There are already 4 PHP answers, most of them shorter than this, but none using this feature, so:

for(;$i++<4;)echo"
Happy Birthday ",["to You","Dear PHP"][$i==3];

Am I the only one noticing that there´s a comma missing?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Am I the only one noticing that there's a useless ?:0? \$\endgroup\$
    – Christoph
    Commented Apr 21, 2017 at 13:43
1
\$\begingroup\$

COBOL, 185 Bytes

IDENTIFICATION DIVISION.
PROGRAM-ID. H.
PROCEDURE DIVISION.
PERFORM X.
PERFORM X.
DISPLAY 'Happy Birthday Dear COBOL'.
PERFORM X.
STOP RUN.
X.
DISPLAY 'Happy Birthday to You'.
STOP RUN.

I'm sure there is a shorter way but I don't know COBOL that well ;-)

\$\endgroup\$
1
\$\begingroup\$

Common LISP, 169 bytes

(defun birthday ()
   (princ "Happy Birthday to You")
   (princ "Happy Birthday to You")
   (princ "Happy Birthday dear Common LISP")
   (princ "Happy Birthday to You"))

Output:

Happy Birthday to You
Happy Birthday to You
Happy Birthday dear Common LISP
Happy Birthday to You
\$\endgroup\$
1
  • 5
    \$\begingroup\$ This is a code-golf challenge but this isn't really golfed... \$\endgroup\$
    – Alex A.
    Commented Jun 22, 2015 at 17:45
1
\$\begingroup\$

tcl, 69 68 65

puts "[set t [set h Happy\ Birthday]\ To\ You]
$t
$h Dear tcl
$t"

demo

\$\endgroup\$
1
\$\begingroup\$

VBA, 58 Bytes

Anonymous VBE immediate window function that takes no input and makes VBA sing its own happy birthday song, alone.

h="Happy Birthday ":t="to You":?h;t:?h;t:?h"Dear VBA":?h;t
\$\endgroup\$
1
\$\begingroup\$

T-SQL, 78 bytes

SELECT a+b+a+b+a+c+a+b
FROM(SELECT'Happy Birthday 'a,'to You
'b,'Dear SQL
'c)t

SQL strings can include line breaks. If you are using SSMS, make sure to use "Results to Text" instead of "Results to Grid"

I used a different technique than the two excellent SQL answers already here:

If a leading newline is allowed (not mentioned in the rules or addressed in the comments), I can save one byte by moving the line break to the beginning of the 'Happy Birthday' string.:

SELECT a+b+a+b+a+c+a+b
FROM(SELECT'
Happy Birthday 'a,'to You'b,'Dear SQL'c)t
\$\endgroup\$
1
\$\begingroup\$

REXX: 73 bytes

n='Happy Birthday to You'   
m='Happy Birthday Dear REXX'
say n                       
say n                       
say m                       
say n  

SAY echoes the data and the output is

Happy Birthday to You   
Happy Birthday to You   
Happy Birthday Dear REXX
Happy Birthday to You                                           
\$\endgroup\$
0
1
\$\begingroup\$

Python 3, 74 bytes i know it's too much

b="Happy Birthday to You\n"
print(b+b+b.replace("to You","Dear Python")+b)

So like... I made the string, and then printed it, tore some off, added some more, and printed it. There ya go.

\$\endgroup\$
2
  • \$\begingroup\$ It may be longer than the current shortest Python answer, but it's a to-the-point approach and a nice first answer nonetheless. +1 from me. Welcome to PPCG, and enjoy your stay! :) \$\endgroup\$ Commented Jul 27, 2018 at 8:57
  • \$\begingroup\$ Thanks! I think code golf is a lot of fun. It's just hard for me to think in code sometimes. \$\endgroup\$
    – Ben
    Commented Jul 27, 2018 at 11:57
1
\$\begingroup\$

Whitespace, 373 bytes

[N
S T S 
N_Call_Label_to_You\n][N
S T 
N_Call_Label_Happy_Birthday_][S S T T   S T T   T   S S N
_Push_-92_newline][S S T    T   N
_Push_-1_e][S S T   T   T   N
_Push_-3_c][S S T   T   S T N
_Push_-5_a][S S S T S T S N
_Push_10_p][S S S T T   S T N
_Push_13_s][S S T   T   N
_Push_-1_e][S S S T T   T   S N
_Push_14_t][S S S T T   N
_Push_3_i][S S S T  S N
_Push_2_h][S S T    T   T   T   T   N
_Push_-15_W][S S T  T   S S S T T   S N
_Push_-70_space][S S S T    T   S S N
_Push_12_r][S S T   T   S T N
_Push_-5_a][S S T   T   N
_Push_-1_e][S S T   T   S S S T S N
_Push_-34_D][N
S T 
N_Call_Label_Happy_Birthday_][N
S T S 
N_Call_Label_to_You\n][N
S T 
N_Call_Label_Happy_Birthday_][N
S T S 
N_Call_Label_to_You\n][N
S T 
N_Call_Label_Happy_Birthday_][N
S S T   N
_Create_Label_LOOP][S S S T T   S S T   T   S N
_Push_102][T    S S S _Add][T   N
S S _Print_as_character][N
S N
T   N
_Jump_to_Label_LOOP][N
S S N
_Create_Label_Happy_Birthday_][S S T    T   S S S T T   S N
_Push_-70_space][S S S T    S S T   T   N
_Push_19_y][S S T   T   S T N
_Push_-5_a][S S T   T   S N
_Push_-2_d][S S S T S N
_Push_2_h][S S S T  T   T   S N
_Push_14_t][S S S T T   S S N
_Push_12_r][S S S T T   N
_Push_3_i][S S T    T   S S T   S S N
_Push_-36_B][S S T  T   S S S T T   S N
_Push_-70_space][S S S T    S S T   T   N
_Push_19_y][S S S T S T S N
_Push_10_p][S N
S _Duplicate_top][S S T T   S T N
_Push_-5_a][S S T   T   T   T   T   S N
_Push_-30_H][N
T   N
_Return][N
S S S N
_Create_Label_to_You\n][S S T   T   S T T   T   S S N
_Push_-92_newline][S S S T  T   T   T   N
_Push_15_u][S S S T S S T   N
_Push_9_o][S S T    T   T   S T N
_Push_-13_Y][S S T  T   S S S T T   S N
_Push_-70_space][S T    S S T   S N
_Copy_2nd_o][S S S T    T   T   S N
_Push_14_t][N
T   N
_Return]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online.

Explanation in pseudo-code:

Call function to_You\n
Call function Happy_Birthday_
Push values for "\necapsetihW raeD" (reversed of "Dear Whitespace\n") to the stack
Call function Happy_Birthday_
Call function to_You\n
Call function Happy_Birthday_
Call function to_You\n
Call function Happy_Birthday_
Start LOOP:
  Integer i = top value of the stack
  i = i + 102
  Print i as character to STDOUT
  Go to next iteration of LOOP

function Happy_Birthday_:
  Push values for " yadhtriB yppaH" (reversed of "Happy Birthday ") to the stack
  Return

function to_You\n:
  Push values for "\nuoY ot" (reversed of "to You\n") to the stack
  Return

Constant 102 was generated with this Java program, and used with this Whitespace tip of mine to print the text by putting the values reversed to the stack, and looping over them (adding the contant value, and printing them as character to the stack; which also exits as soon as we don't have any more values on the stack).

In addition, the functions with return are used to prevent duplicated code for the repeated parts of the output-text. And there were two more things to golf:

  1. The value for the second p in "Happy" (which was SSSTSTSN - push 10) has been replaced with SNS (duplicate top).
  2. The value for the second o in "to You" (which was SSSTSSTN - push 9) has been replaced with STSSTSN (copy 2nd [1-indexed]). (Relevant Whitespace tip of mine.)
\$\endgroup\$
1
\$\begingroup\$

Pyth - 42 40 bytes

J." y-÷\n3ª¼öj"K+J"to you"KK+J"dear Pyth"K

J." y-÷\n3ª¼öj"                            Assign J to "Happy Birthday "
               K+J"To you"                 Assign K to J + "to you"
                          KK               Print K twice
                            +J"dear Pyth"  Print J+"dear Pyth"
                                         K Print K
\$\endgroup\$
1
\$\begingroup\$

05AB1E, 29 bytes

”to€î”Д¬Ž 05AB1E”s)”ŽØ¢© ”ì»

Try it online!

”to€î”                 # dictionary string "to You"
      Ð                # triplicate
”¬Ž 05AB1E”            # dictionary string "Dear 05AB1E"
           s           # swap
            )          # wrap entire stack in an array
”ŽØ¢© ”                # dictionary string "Happy Birthday "
       ì               # prepend to each string in the array
        »              # join array by newlines
\$\endgroup\$
1
\$\begingroup\$

Keg, 74 bytes

(2|Happy Birthday to You\
)
Happy Birthday Dear Keg\
Happy Birthday to You
\$\endgroup\$
1
  • \$\begingroup\$ I feel like I may be seeing this again in 2 months! \$\endgroup\$
    – lyxal
    Commented Sep 15, 2019 at 1:12
1
\$\begingroup\$

Stax, 28 bytes

▄Jÿø•2╜x!╨¬r├^↑#8╕Γ☺°7¿5⌠☻U▄

Run and debug it at staxlang.xyz!

I'm two weeks late. Alas. But it's short, at least...

Unpacked (34 bytes) and explanation:

`/&tpz/b}"=J:J=P*``!0 ZrO"`n)ncLmT

`/&tpz/b}"=J:J=P*`                    Literal "Happy Birthday to You   "
                  `!0 ZrO"`           Literal "Dear Stax"
                           n          Copy the first line to the top of the stack
                            )         Overwrite end with "Dear Stax"
                             nc       Copy the first line twice more to the top
                               L      Collect stack in a list
                                mT    Print each, trimmed of trailing spaces, on its own line

If you're fine with those three trailing spaces, drop the T for 33 bytes unpacked. Still 28 packed, unfortunately.

\$\endgroup\$
1
\$\begingroup\$

JavaScript (84 76 bytes)

x=`Happy Birthday To You\n`,alert(x+x+`Happy birthday Dear JavaScript\n`+x)

Output:

Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear JavaScript
Happy Birthday To You
\$\endgroup\$
1
  • 2
    \$\begingroup\$ You have an extra “s” in “JavaScript”. And x+x is shorter than x.repeat(2). \$\endgroup\$
    – manatwork
    Commented Jan 22, 2020 at 12:01
1
\$\begingroup\$

W d, 34 bytes

Short language name to the rescue!

W is just 0.0833 years old but I'm still posting this ... Insanely long but oh well.

♣∙♥ª¬^╗Γë├ΦñtQOi▼!◙╖☼▓Φ◙ï╔♀EÞr!R╫J

Explanation

4                                       E % Foreach in the range from 1 to 4:
 "Happy Birthday "                        % Append the string "Happy Birthday "
                  a3=                     % If this is the third line:
                     "Dear W"&            % Output "Dear W"
                              "to You"|   % Otherwise, output "to You"
                                       +  % Join the two strings.
                                          % Output a newline.
\$\endgroup\$
1
\$\begingroup\$

///, 46 bytes

/~/
Happy Birthday //-/~to You/--~Dear \/\/\/-

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Julia, 63 bytes

a="Happy Birthday To You\n";print(a^2*a[1:15]*"Dear Julia\n"*a)

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to the site, and nice first answer! I've edited your answer just a little bit to be closer to the standard answer format we use on the site, including a link to an online interpreter so others can test your code \$\endgroup\$ Commented Oct 20, 2020 at 15:29
1
\$\begingroup\$

naz, 210 bytes

1x1f0m9a8m1o9a9a7a1o9a6a2o9a1o4d2a1o2d4m2a1o5d8m1a1o9a1o2a1o9s3s1o4s1o3s1o9a9a6a1o4d2a1o0x1x2f2d7m4a1o5s1o3d5s1o3m7s1o3d4m5s1o6a1o9d3s1o0x1f2f1f2f1f2m4a1o3d5m9s1o4s1o9a8a1o3d6s1o3m9a5a1o9s4s1o9a9a7a1o9d3s1o1f2f

I haven't had much time for code golf lately, but I had to get this challenge knocked out: at the time of writing, naz's GitHub repo was created exactly 1 year and a few minutes ago. Happy birthday, my child.

Output includes an extra trailing newline.

Explanation (with 0x commands removed)

# Function 1
# Output "Happy Birthday "
1x1f0m9a8m1o9a9a7a1o9a6a2o9a1o4d2a1o2d4m2a1o5d8m1a1o9a1o2a1o9s3s1o4s1o3s1o9a9a6a1o4d2a1o
# Function 2
# Output "to You\n"
1x2f2d7m4a1o5s1o3d5s1o3m7s1o3d4m5s1o6a1o9d3s1o

1f2f1f2f1f                                                 # Output the first 2.5 lines
2m4a1o3d5m9s1o4s1o9a8a1o3d6s1o3m9a5a1o9s4s1o9a9a7a1o9d3s1o # Output "Dear naz\n"
1f2f                                                       # Output the last line
\$\endgroup\$
1
  • 1
    \$\begingroup\$ happy birthday naz! \$\endgroup\$
    – Razetime
    Commented Dec 13, 2020 at 4:15
1
\$\begingroup\$

Duocentehexaquinquagesimal, 433 211 bytes

-222 thanks to ovs.

3∞н5Ćf–γúpïJ₂BΛ™H&¬¡ÌÿD"çÑ^oºvÄv»Ö{ž£&B#žà₆?àë”%₄J€Ba{‹Ƶiê)Jkí:¼Ω3ÃzjWÝ„|†rвávĀÜΛ°λöyÅÍ`mΣ×>K$λÜ—∍¯zÏΔ!#äy½´`в²!ÚÉ¡]5мô₃^Íp÷‰Ê)ûEîTº8E&sÙγüíθ4®₄ñтšиćÙA4ºÚIÜζ∍õ+¦ôι«$ι<yf·¶ê‹žƵ=v™>jg¥¢¦ŽнhΔÐŽÎΩć7∞ñè₄ćD祃¨=ŽαxO,š

Try it online! This answer was posted on the same day that I created Duocentehexaquinquagesimal. Happy birthday!

\$\endgroup\$
3
  • \$\begingroup\$ 594 bytes brainfuck program generated by bfbrute. \$\endgroup\$
    – ovs
    Commented Apr 15, 2021 at 7:58
  • \$\begingroup\$ 560 bytes \$\endgroup\$
    – ovs
    Commented Apr 15, 2021 at 8:36
  • \$\begingroup\$ @ovs thanks a lot! \$\endgroup\$
    – Makonede
    Commented Apr 15, 2021 at 15:49
1
\$\begingroup\$

BRASCA, 72 67 bytes

I really should add string compression...

l`uoY ot yadhtrib yppaH`58S[$:om{]xl`ACSARB raeD `L[$o{]x8p21S[$o{]

Try it online!

Explanation

l`uoY ot yadhtrib yppaH`                                                 - Push "Happy birthday to You\n"
                        58S[$:om{]x                                      - Output it twice followed by "Happy birthday"
                                   l`ACSARB raeD `                       - Push " Dear BRASCA\n"
                                                  L[$o{]x                - Output it
                                                         8p              - Shift the stack so the top is "Happy birthday to You"
                                                           21S[$o{]      - Output that.
\$\endgroup\$
2
  • \$\begingroup\$ is BRASCA a golfing language? \$\endgroup\$
    – Razetime
    Commented May 18, 2021 at 9:33
  • \$\begingroup\$ Not really, I just made it for fun. String compression would definitely be nice to add to it. \$\endgroup\$ Commented May 18, 2021 at 9:35
1
4
5
6 7 8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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