43
\$\begingroup\$

Your task is to print the text Good morning, Green orb!, with every character repeated in place as many times as the most frequent byte in your source (the mode). A trailing newline is permitted and need not be repeated.

For example if your source was

print p

Since p appears twice and every other byte appears once you would need to print

GGoooodd  mmoorrnniinngg,,  GGrreeeenn  oorrbb!!

Answers will be scored by the product of their byte count and the number of times the output is repeated. For example the above code (if it worked) would score 7*2 = 14. The goal should be to minimize one's score.

Your code must contain at least 1 byte.

Use this program to verify that your code and output match

\$\endgroup\$
  • \$\begingroup\$ Functions are allowed, right? \$\endgroup\$ – totallyhuman Dec 28 '17 at 20:05
  • 1
    \$\begingroup\$ @totallyhuman Yes, so long as they don't take input. \$\endgroup\$ – Ad Hoc Garf Hunter Dec 28 '17 at 20:05
  • 1
    \$\begingroup\$ Shouldn't this be tagged quine? \$\endgroup\$ – FantaC Dec 29 '17 at 16:12
  • \$\begingroup\$ Morning can't be capitalized, can it haha? \$\endgroup\$ – Magic Octopus Urn Jan 10 '18 at 19:56
  • \$\begingroup\$ @magicoctopusurn Nope the text should be the same. \$\endgroup\$ – Ad Hoc Garf Hunter Jan 10 '18 at 20:06

41 Answers 41

1
2
1
\$\begingroup\$

brainfuck, 414 * 163 = 67,482

-[>-<---]>-------->>>-[>+>+>+>>+>+>+>+>+>+>+>>>+>+>+>+>+>>+>+>++<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<-----]<-[>+<-------]>-->+++++++++>+++++++++>-->------------------->+++++++>+++++++++>++++++++++++>++++++++>+++>++++++++>+>------->------------------->------------------------------->++++++++++++>->->++++++++>------------------->+++++++++>++++++++++++>---->>++++[<++++++++>-]<+[<]>[<<<[>+>+<<-]>>[->.<]>[-]>]

Try it online!

I'm not very good at brainfuck so this is likely far from optimal, but it works.

Explanation

The first part is

-[>+>+>+>>+>+>+>+>+>+>+>>>+>+>+>+>+>>+>+>++<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<-----]<-[>+<-------]>-->+++++++++>+++++++++>-->------------------->+++++++>+++++++++>++++++++++++>++++++++>+++>++++++++>+>------->------------------->------------------------------->++++++++++++>->->++++++++>------------------->+++++++++>++++++++++++>---->>++++[<++++++++>-]<+[<]>

This writes the charcodes for

Good morning, Green orb!

to memory in order. It is certainly the place that could use the most optimization.

Then we have

[<<<[>+>+<<-]>>[->.<]>[-]>]

Which goes and prints off each character as many times as we tell it. Since there are 163 pluses in the program we tell it to print each character 163 times.

-[>-<---]>--------
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Standard ML (MLton), 84*5=420 83 bytes * 5 = 415

map(fn$ =>map(fn _=>print(str$))[0,2,3,4,5])(explode"Good mor\110ing, Green orb!");

Try it online!


Alternative approach (same score)

String.map;it(fn c=>(print(it(fn _=>c)"vwxyz");c))"Good mor\110i\110g, Green orb!";

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Noether, 42 bytes * 4 = 168

"Good morning, Green orb!"~sL(si/4*Pi1+~i)

Outputs:

GGGGoooooooodddd    mmmmoooorrrrnnnniiiinnnngggg,,,,    GGGGrrrreeeeeeeennnn    oooorrrrbbbb!!!!

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

><>, 41 bytes x 7 = 287

|v"Good morning, Green orb!"
o\! !\:::|oo

Try it online!

As 'o' is used as the print character, this uses some mirrors to reuse them for printing.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ @HeebyJeebyMan completely forgot to add that on, changed it now thanks :) \$\endgroup\$ – Teal pelican Jan 16 '18 at 9:33
  • 1
    \$\begingroup\$ 44*3 \$\endgroup\$ – Jo King Feb 12 '19 at 7:39
1
\$\begingroup\$

Perl 6, 3 * 54 bytes = 162

<<"G{q`o`x 2}d"morning,'Green'orb!>>~~say S:g{.}=$/x 3

Try it online!

I started off with the normal:

"Good morning, Green orb!"~~(S:g{.}=$/x 4).say

Which simply replaces each letter by 4 copies of itself and prints. The mode characters were the spaces and the os, so I changed the string part to a word quote with interpolation:

<<Good morning,'Green'orb!>>~~say S:g{.}=$/x 4

This decreased the spaces down to 3. Next was the o, which I decided to double in the oo part of Good.

<<"G{q`o`x 2}d"morning,'Green'orb!>>~~say S:g{.}=$/x 4

This involved wrapping the Good in interpolating quotes of its own, then having to use a custom quoting construct to do the o character, since the quote characters were taken.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

K (oK), 35 bytes * 4 = 140

Solution:

`0:,/4#'"Good morning, Green orb!";

Try it online!

Explanation:

Nothing fancy here, the most common letter is o which occurs 4 times.

`0:,/4#'"Good morning, Green orb!"; / the solution
        "Good morning, Green orb!"  / the string to be displayed
     4#'                            / 4 take (#) each (') repeats each character 4 times
   ,/                               / flatten these lists
`0:                               ; / print to stdout (`0:) and swallow return value (;)
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Swift, 53*3=159 bytes

{"Good morning, Green \u{6f}rb!".flatMap{[$0,$0,$0]}}

Try it online!

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

05AB1E, 22 bytes * 2 = 44

”‚¿•´,ˆ¨ orb!”'m5ǝ2иζJ

Try it online!


If I am able to output title-cased:

05AB1E, 13 bytes

”‚¿•´,ˆ¨ Orb!

Try it online!

Please note, CP-1252 is not a comma, therefore there are no dupes.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Java 11, score: 455 (91 bytes * 5)

x->{for(var s:"G\157od mo\162ning, G\162een orb!".split(""))System.out.print(s.repeat(5));}

The e, o, r, and t are all four used 5 times.

Try it online.

Explanation:

x->{                     // Method with empty unused parameter and no return-type
  for(var s:"G\157od mo\162ning, G\162een orb!"
                         //  Push String "Good morning, Green orb!"
            .split(""))  //  And loop over its characters as Strings
    System.out.print(s   //   Print the current character
      .repeat(5));}      //   Repeated 5 times
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

AWK, 59 bytes × 4 = 236

BEGIN{$0="Good morning, Green orb!";gsub(/./,"&&&&");print}

Try it online!

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Pip, 42*4 = 168

a:"Good morning, Green orb!"Fi,#a{L4O(ai)}

Try it online!

| improve this answer | |
\$\endgroup\$
1
2

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.