2
\$\begingroup\$

These days, I watched on TV a Gay Pride parade; at the time, I was thinking about quines and how they're a bit queer, outputting themselves (out of the closet?) and, well, why not combine both things into a Quine Pride Parade?

The challenge is to write a program that:

  1. Is a quine.

  2. Prints the sentence I am a quine written in <language name>, and very proud of it! with the name of the language you're using in place of language name.

  3. Contains the sentence within a rectangular frame of non-whitespace characters, with at least one row/column of spaces above, below, before and after it.

  4. Contains the sentence in three rows, with centered text, like in my entry below. You can add at most one space before the language name, to align the second line within the frame.

The program itself does not need to have a rectangular form, but must frame the sentence.

Scoring

As Dennis pointed out, languages with shorter names have an advantage, and most bytes will go into the frame.

So, the scoring will be as follows: size of the program (in bytes), minus the size of the language's name, minus 140 (a tweet's size). The following bonuses are applied after that:

  • -50% if the program also accepts a custom sentence, outputs it on the generated program's frame instead of the default message, and the generated program is still a quine. Assume a tweet-sized sentence (140 chars max). Without input, it can output, either the default sentence above, or an empty frame.

  • -30% if the program shows only one copy of the sentence (the other should be obfuscated).

The bonuses stack: getting both does (n - 50%) - 30% = 0.5n - 30% = 0.35n.

The smallest score wins.

Here is my entry, in Ruby - should have a linebreak at the end. No bonus, score 399 = 543 bytes - 4 - 140.

q=34.chr;e=10.chr;prideful=''+
'                         '+e+
'      I am a quine       '+e+
'    written in  Ruby,    '+e+
'  and very proud of it!  '+e+
'                         '+e;s=[
"q=34.chr;e=10.chr;prideful=''+",
"'                         '+e+",
"'      I am a quine       '+e+",
"'    written in  Ruby,    '+e+",
"'  and very proud of it!  '+e+",
"'                         '+e;s=[",
"@",
"];t=s.map{|x|q+x+q}.join(','+e)",
"s.each{|y|puts(y!='@'?y:t)}"
];t=s.map{|x|q+x+q}.join(','+e)
s.each{|y|puts(y!='@'?y:t)}

It is a classic quine format: s contains itself, as an array (one element per line), except for itself's quote (the @); then, joins s, substituting @ by the join, quoted.

The program can clearly be golfed further: I went for a nice rectangular format instead.

\$\endgroup\$
  • 2
    \$\begingroup\$ The idea of quines being queer and being "in the closet" is making me laugh so much that I have to attempt this. \$\endgroup\$ – cat Nov 25 '15 at 0:06
  • 1
    \$\begingroup\$ Can I have bonus points if I use terminal colour codes to make it coloured like a rainbow flah? \$\endgroup\$ – cat Nov 25 '15 at 0:12
  • \$\begingroup\$ For the -50% bonus. Can we assume input will always be provided? \$\endgroup\$ – Downgoat Nov 25 '15 at 0:14
  • 4
    \$\begingroup\$ For many languages, most parts of the program will consist of padding to achieve the frame. For all of these languages, the decisive factor will be which one has the shortest name. \$\endgroup\$ – Dennis Nov 25 '15 at 2:39
  • \$\begingroup\$ Now that this has been reopened, is a cheating quine okay? My language can't make a real quine. \$\endgroup\$ – cat Dec 15 '15 at 3:38
3
\$\begingroup\$

Aubergine, 7*24+1-9=160-140=20-30%=14 bytes

-a1+a1=oA=Bi-BA:bB=iaooo
o                      o
o I am a quine written o
o  in Aubergine, and   o
o  very proud of it!   o
o                      o
oooooooooooooooooooooooo    (removethis)

The (removethis) is not code, but is just there to protect the trailing whitespace.

It's just my standard aubergine quine with all the extra stuff stuck in it to meet requirements.

\$\endgroup\$
  • \$\begingroup\$ On the spot! Will you try for the other bonus? \$\endgroup\$ – jose_castro_arnaud Nov 26 '15 at 21:46
  • \$\begingroup\$ No. Doing so would massively increase my score as writing a custom message in the required positions, with line breaks in sane places requires an enormous amount of flow control, which is difficult in this language. This is the best score this language can get. (A language with a shorter name will be able to do a lot better.) \$\endgroup\$ – quintopia Nov 27 '15 at 1: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.