23
\$\begingroup\$

When this question was posted, it was caird coinheringaahing's birthday! (source: 1, 2, 3, 4) (It was also World Emoji Day.)

As a bit of some CGCC lore, caird's name came from a Jelly answer by Dennis (source) - the compressed form of "Code Golf" in Jelly is “½ċṭ6Ỵ», and if you insert a space (“½ċṭ6 Ỵ»), it becomes "caird coinheringaahing" instead, which was important for this challenge as the former is lexicographically smaller than "Programming Puzzles", but the latter is larger.

Shifting the space around also gives some other resulting strings, and among them is "ChartZ Belatedly", which was caird's username during March of 2021.

Challenge

Output the string Happy Birthday, caird coinheringaahing! exactly.

The catch: for every character in your code, there must be at least one valid position that you can move it to such that the resulting program outputs Happy Birthday, ChartZ Belatedly! exactly.

For example, if abcd outputs the first string and bcad, acdb, cabd, and abdc output the second string, then this would be a valid program (a can be moved to the third position, b to the fourth, c to the first, and d to the third).

(The idea for this came from caird themself, actually, so thanks to them :P)

Rules

  • You may output any amount of leading or trailing whitespace, and it does not have to be consistent either between the two strings or between varying programs printing the second string. For example, printing "Happy Birthday, ChartZ Belatedly! " for bcad and " \nHappy Birthday, ChartZ Belatedly! \t \r\n" for acdb would be valid.
  • No input will be given (the standard rules like allowing accepting an empty/null input apply).
  • Your output method must be consistent though, so for example, if you print to STDOUT for the first string, you must do so for all other strings.
  • You must not output anything else with the chosen output method, but you can output to other methods (what I mean by this is if you output to STDOUT, you can flood STDERR with random garbage, and if your submission is a function that produces the result, you can output freely to STDOUT, etc.)

Scoring

This is a challenge still, so the shortest answer in bytes wins among submissions in its language.

\$\endgroup\$
0
16
\$\begingroup\$

Zsh -y, 145 148 144 142 131 130 bytes

1="echo Happy Birthday, ";$1caird coinheringaahing!>x
"\";$1ChartZ Belatedly!>x #"
"\";echo Happy Birthday, ChartZ Belatedly!>x #"

Attempt This Online!

Outputs to a file called x, which allows us to save bytes exiting because we can overwrite the file to change the output instead of needing to exit the program.

  • Any character on the first line, including its trailing newline, should go between the \ and " on the third line
  • The final " on the second line should go at the end of the third, and vice versa
  • Any other character on the second line, including its trailing newline, should go between the \ and " on the third line, and vice versa

Some of the modified programs are highly cursed. For instance, moving the x on the first line:

1="echo Happy Birthday, ";$1caird coinheringaahing!>
"\";$1ChartZ Belatedly!>x #"
"\x";echo Happy Birthday, ChartZ Belatedly!>x #"

This produces a "parse error" because of the trailing >, but zsh ...just continues executing the program??

\$\endgroup\$
2
  • \$\begingroup\$ Where do you move the newlines? \$\endgroup\$ – xigoi Jul 18 at 7:23
  • 1
    \$\begingroup\$ @xigoi The first newline is considered a character on the first line, and the same for the second. So the first newline goes between the \" on the second line and vice versa \$\endgroup\$ – pxeger Jul 18 at 7:57
11
\$\begingroup\$

Jelly, 88 69 bytes

FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN»

Try it online!

A niladic link that prints "Happy Birthday, caird coinheringaahing!"

Thanks to @JonathanAllan for pointing out I could save 19 bytes by changing the last string to a compressed one.

Explanation of base script:

F         | Flatten
 L        | Length
  e33,39  | Is one of 33 or 39
        ḷ | Left (effectively a no-op here)
““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»                                           | ["", "Happy Birthday, caird coinheringaahing!"]
                                 Ç?                         | If helper link returns truthy:
                 ¹                                          | - Identity function
                  “®Ẉ'¶ẒȮzṂ#jKgN»                           | Else: ["", "Happy Birthday, ChartZ Belatedly!"]
                                   Çȧ$                      | helper(x) logical and x
                                      Çȧ$                   | helper(x) logical and x
                                         ḷ                  | Left (effectively a no-op here)
                                          ȯ““®Ẉ'¶ẒȮzṂ#jKgN» | logical or ["", "Happy Birthday, ChartZ Belatedly!"]

Here are the variants (produced by this script) that print "Happy Birthday, ChartZ Belatedly!":

 0 F 10 Le33,39ḷ¶“F“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 1 L 10 Fe33,39ḷ¶“L“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 2 e 26 FL33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»e¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 3 3 10 FLe3,39ḷ¶“3“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 4 3 10 FLe3,39ḷ¶“3“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 5 , 10 FLe3339ḷ¶“,“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 6 3 10 FLe33,9ḷ¶“3“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 7 9 10 FLe33,3ḷ¶“9“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 8 ḷ 10 FLe33,39¶“ḷ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
 9 ¶  1 F¶Le33,39ḷ““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
10 “ 13 FLe33,39ḷ¶“ṂḤ“¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
11 “ 13 FLe33,39ḷ¶“ṂḤ“¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
12 Ṃ 13 FLe33,39ḷ¶““ḤṂ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
13 Ḥ 11 FLe33,39ḷ¶“Ḥ“Ṃ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
14 ¿ 11 FLe33,39ḷ¶“¿“ṂḤ§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
15 § 11 FLe33,39ḷ¶“§“ṂḤ¿⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
16 ⁹ 10 FLe33,39ḷ¶⁹““ṂḤ¿§Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
17 Ṫ 11 FLe33,39ḷ¶“Ṫ“ṂḤ¿§⁹¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
18 ¶ 11 FLe33,39ḷ¶“¶“ṂḤ¿§⁹Ṫ3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
19 3 10 FLe33,39ḷ¶3““ṂḤ¿§⁹Ṫ¶ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
20 Ẋ 11 FLe33,39ḷ¶“Ẋ“ṂḤ¿§⁹Ṫ¶3ñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
21 ñ 10 FLe33,39ḷ¶ñ““ṂḤ¿§⁹Ṫ¶3ẊɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
22 ɼ 11 FLe33,39ḷ¶“ɼ“ṂḤ¿§⁹Ṫ¶3ẊñṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
23 ṃ 10 FLe33,39ḷ¶ṃ““ṂḤ¿§⁹Ṫ¶3ẊñɼṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
24 Ṁ 11 FLe33,39ḷ¶“Ṁ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
25 Ƙ 11 FLe33,39ḷ¶“Ƙ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
26 » 10 FLe33,39ḷ¶»““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
27 ¹ 10 FLe33,39ḷ¶¹““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
28 “ 27 FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»“¹®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
29 ® 11 FLe33,39ḷ¶“®“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
30 Ẉ 11 FLe33,39ḷ¶“Ẉ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
31 ' 11 FLe33,39ḷ¶“'“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
32 ¶ 11 FLe33,39ḷ¶“¶“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
33 Ẓ 11 FLe33,39ḷ¶“Ẓ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
34 Ȯ 11 FLe33,39ḷ¶“Ȯ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
35 z 11 FLe33,39ḷ¶“z“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
36 Ṃ 11 FLe33,39ḷ¶“Ṃ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮz#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
37 # 11 FLe33,39ḷ¶“#“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂjKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
38 j 10 FLe33,39ḷ¶j““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#KgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
39 K 11 FLe33,39ḷ¶“K“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
40 g 11 FLe33,39ḷ¶“g“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
41 N 11 FLe33,39ḷ¶“N“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKg»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
42 » 41 FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKg»NÇ?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
43 Ç 11 FLe33,39ḷ¶“Ç“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
44 ? 43 FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»?ÇÇȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
45 Ç 11 FLe33,39ḷ¶“Ç“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?ȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
46 ȧ 10 FLe33,39ḷ¶ȧ““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Ç$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
47 $ 11 FLe33,39ḷ¶“$“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?ÇȧÇȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
48 Ç 11 FLe33,39ḷ¶“Ç“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$ȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
49 ȧ 43 FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»ȧÇ?Çȧ$Ç$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
50 $ 27 FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»$¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
51 ḷ 10 FLe33,39ḷ¶ḷ““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ȯ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
52 ȯ 11 FLe33,39ḷ¶“ȯ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷ““®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
53 “ 14 FLe33,39ḷ¶““ṂḤ“¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ“®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
54 “ 14 FLe33,39ḷ¶““ṂḤ“¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ“®Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
55 ® 11 FLe33,39ḷ¶“®“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““Ẉ'¶ẒȮzṂ#jKgN» Try It Online!
56 Ẉ 11 FLe33,39ḷ¶“Ẉ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®'¶ẒȮzṂ#jKgN» Try It Online!
57 ' 11 FLe33,39ḷ¶“'“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ¶ẒȮzṂ#jKgN» Try It Online!
58 ¶ 11 FLe33,39ḷ¶“¶“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'ẒȮzṂ#jKgN» Try It Online!
59 Ẓ 11 FLe33,39ḷ¶“Ẓ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ȮzṂ#jKgN» Try It Online!
60 Ȯ 11 FLe33,39ḷ¶“Ȯ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒzṂ#jKgN» Try It Online!
61 z 11 FLe33,39ḷ¶“z“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮṂ#jKgN» Try It Online!
62 Ṃ 11 FLe33,39ḷ¶“Ṃ“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮz#jKgN» Try It Online!
63 # 11 FLe33,39ḷ¶“#“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂjKgN» Try It Online!
64 j 10 FLe33,39ḷ¶j““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#KgN» Try It Online!
65 K 11 FLe33,39ḷ¶“K“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jgN» Try It Online!
66 g 11 FLe33,39ḷ¶“g“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKN» Try It Online!
67 N 11 FLe33,39ḷ¶“N“ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKg» Try It Online!
68 » 42 FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN Try It Online!
\$\endgroup\$
1
  • 1
    \$\begingroup\$ FLe33,39ḷ¶““ṂḤ¿§⁹Ṫ¶3ẊñɼṃṀƘ»¹“®Ẉ'¶ẒȮzṂ#jKgN»Ç?Çȧ$Çȧ$ḷȯ““®Ẉ'¶ẒȮzṂ#jKgN» works for 69. (Employed your Python script). \$\endgroup\$ – Jonathan Allan Jul 18 at 19:59
10
\$\begingroup\$

C, 148 bytes

/**/main(){printf("Happy Birthday, %s!",'\0'?"ChartZ Belatedly":"caird coinheringaahing");}///*/b;main(){puts("Happy Birthday, ChartZ Belatedly!");}
  • Any character within the first main definition is moved to separate the first */, so the comment does not end there; it ends at the second */, and the second main definition applies.
  • Any of the first four characters /**/, except the first, is moved to make it /*/*, with the same effect.
  • The first character, /, is moved one step right, making the program begin */*/. This leaves * outside the comment, which combines with the later b; (a declaration of an implicit-int global variable) to form * b; (which declares b as a pointer to int).
  • Any other character (starting from ///*/) is moved into '\0', after the first ', to make it a multicharacter constant with a nonzero value, changing the string selected by the ? :; the last part originally beginning with three slashes ensures that it remains a line comment after any character is taken out from it.
\$\endgroup\$
0
8
\$\begingroup\$

Klein 000, 133, 120, 119, 111 bytes

.\"Happy Birthday, "\"ChartZ Belatedly!"@
>."Happy Birthday, ChartZ Belatedly!"@
"oinheringaahing!"@.>"caird c"

Try it online!

The idea of this follows the classic klein / approach. We have 3 programs and we use the alignment to select which one we run. All of our swaps move one character to a different line breaking the alignment and putting it into a different program.

The breakdown

If the character is one of the first two then we swap them

\."Happy Birthday, "\"ChartZ Belatedly!"@
>."Happy Birthday, ChartZ Belatedly!"@
"oinheringaahing!"@.>"caird c"

Anything else on the first line we can put at the begining of the second line.

.\"Happy Birhday, "\"ChartZ Belatedly!"@
t>."Happy Birthday, ChartZ Belatedly!"@
"oinheringaahing!"@.>"caird c"

For the first two characters of the second line we can swap them too.

.\"Happy Birthday, "\"ChartZ Belatedly!"@
.>"Happy Birthday, ChartZ Belatedly!"@
"oinheringaahing!"@.>"caird c"

For the rest of the line we can insert it before the . in the third line

.\"Happy Birthday, "\"ChartZ Belatedly!"@
>."Happy Birhday, ChartZ Belatedly!"@
"oinheringaahing!"@t.>"caird c"

Any character on the third line can be inserted at the front of the second line.

.\"Happy Birthday, "\"ChartZ Belatedly!"@
a>."Happy Birthday, ChartZ Belatedly!"@
"oinheringahing!"@.>"caird c"

Finally we can do the newlines as follows:

.\"Happy Birthday, "\"ChartZ Belatedly!"
@>."Happy Birthday, ChartZ Belatedly!"@
"oinheringaahing!"@.>"caird c"
.\"Happy Birthday, "\"ChartZ Belatedly!"@
>."Happy Birthday, ChartZ Belatedly!"@"oinheringaahing!"@.>"caird c
"
\$\endgroup\$
5
\$\begingroup\$

Python 3, 130 bytes

'''''';print("Happy Birthday,",""and"ChartZ Belatedly!"or"caird coinheringaahing!")#''';print('Happy Birthday, ChartZ Belatedly!')

Try it online!

Alternate programs

  • Byte 1 to 6: The ' is moved behind the first ;, therefore characters 1 to 87 are a string and are disregarded. Characters 89+ are executed.

    ''''';'print("Happy Birthday,",""and"ChartZ Belatedly!"or"caird coinheringaahing!")#''';print('Happy Birthday, ChartZ Belatedly!')
    
  • Byte 7 to 84: The byte is moved behind the fifth byte. As none of these characters is a ', this also creates a string from character 1 to character 87, with the same effects as above.

    '''''"';print(Happy Birthday,",""and"ChartZ Belatedly!"or"caird coinheringaahing!")#''';print('Happy Birthday, ChartZ Belatedly!')
    
  • Byte 85-130: The byte is moved between the "" at position 32-33. This makes the string a truthy value and the other string is printed. There is no " in byte 85-130, so this will always work. The second part of the program is not executed, because it is commented out.

    '''''';print("Happy Birthday,","'"and"ChartZ Belatedly!"or"caird coinheringaahing!")#''';print(Happy Birthday, ChartZ Belatedly!')
    
\$\endgroup\$
5
\$\begingroup\$

JavaScript, 123 bytes

17/**/,x=>"Happy Birthday, "+(''?"ChartZ Belatedly!":"caird coinheringaahing!")//**/,x=>"Happy Birthday, ChartZ Belatedly!"

Try it online!

Variations

(full text omitted for brevity)

17/**/,x=>"HB"+(''?"CB":"cc")//**/,x=>"HBCB"
7/**1/,x=?"HB"+(''?"CB":"cc")//**/,x=>"HBCB"
1/**7/,x=>"HB"+(''?"CB":"cc")//**/,x=>"HBCB"
17**/,x=>"HB"+(''?"CB":"cc")//*/*/,x=>"HBCB" (syntax highlighting is broken, but runs ok)
17/*/*,x=>"HB"+(''?"CB":"cc")//**/,x=>"HBCB"
17/**,/x=>"HB"+(''?"CB":"cc")//**/,x=>"HBCB"
17/**x/,=>"HB"+(''?"CB":"cc")//**/,x=>"HBCB"
17/**=/,x>"HB"+(''?"CB":"cc")//**/,x=>"HBCB"
// ...
17/**"/,x=>"HB'+('"?"CB":"cc)//**/,x=>"HBCB"
17/**)/,x=>"HB"+(''?"CB":"cc"//**/,x=>"HBCB"
17/**/,x=>"HB"+('/'?"CB":"cc")/**/,x=>"HBCB"
17/**/,x=>"HB"+('*'?"CB":"cc")//*/,x=>"HBCB"
17/**/,x=>"HB"+('/'?"CB":"cc")//**,x=>"HBCB"
17/**/,x=>"HB"+('x'?"CB":"cc")//**/,=>"HBCB"
// ...
17/**/,x=>"HB"+('B'?"CB":"cc")//**/,x=>"HBC"
17/**/,x=>"HB"+('"'?"CB":"cc")//**/,x=>"HBCB
\$\endgroup\$
2
  • \$\begingroup\$ This appears to be a snippet, which is not an allowed IO method on this site. You need to change it to use console.log or similar \$\endgroup\$ – pxeger Jul 25 at 6:19
  • \$\begingroup\$ @pxeger Hmm, I thought an expression evaluating to the output was allowed, but I don't see it in the meta thread. I've updated my answer accordingly. \$\endgroup\$ – tjjfvi Jul 25 at 14:57
4
\$\begingroup\$

JavaScript (browser), 146 bytes

Based off of the C and python answers.

This is too long and it still seems sketchy to me

0/**/;;alert(""?"Happy Birthday, ChartZ Belatedly!":"Happy Birthday, caird coinheringaahing!")//*/-1;alert('Happy Birthday ChartZ Belatedly!')//*/

Where to move:

  • The 0 goes after the second asterisk
  • The first slash moves to the right, forming 0* -1
  • The first two asterisks and the second slash can move to right anywhere before the //*/-1
  • The first two semicolons go inside the empty string
  • Any text between the two semicolons and the //*/-1 go after the second asterisk
  • Any text starting from //*/-1 goes inside the empty string

Try this mess online!

Hope this is valid and it works aaaa

New contributor
Ectogen is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
5
  • 2
    \$\begingroup\$ Welcome to Code Golf! I don't think this is valid - note that the question says "for every character in your code, there must be at least one valid position that you can move it to". Is it possible to move e.g. the ? to a position where the program will then output Happy Birthday, ChartZ Belatedly!? \$\endgroup\$ – caird coinheringaahing Jul 23 at 16:34
  • \$\begingroup\$ Thanks! And, ohh I didn’t read that 🤦‍♂️ ok now it seems impossible to me, I guess I’ll try:) (I’ll just edit the post if I find something) \$\endgroup\$ – Ectogen Jul 23 at 16:45
  • 1
    \$\begingroup\$ Welcome to Code Golf! You can delete your post for now, edit it to be valid, and then undelete it. \$\endgroup\$ – user Jul 23 at 17:00
  • 1
    \$\begingroup\$ Looks valid now, aside from the fact that it should be caird (with a d, not a t) :P \$\endgroup\$ – caird coinheringaahing Jul 23 at 18:24
  • \$\begingroup\$ Oops, sorry! I’m bad at names. I’ve fixed it now \$\endgroup\$ – Ectogen Jul 23 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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