3
\$\begingroup\$

I personally love quines, but they all seem to be so... static. So why not create a quine that can do more.

Challenge

The challenge here is to create a quine that without any sort of input is a normal quine. Then if it receives a different input, it outputs a different quine in a different language. (basically like a polyglot, but it doesn't have to return to the original source code)

EX:

Starting program:

James

Given no input or 0 as input, the code above outputs:

James

Given 1 as input, the code outputs:

Kendra

Given 2 as input, the code outputs:

Alexander

And so on...

Requirements

Like with any other quine challenge, no examining source code directly!

Inputs are either nothing, or a positive integer.

Each quine must not be less than \$ceil(n/4)\$ levenshtein distance from all other quines, where \$n\$ is the length of the original quine. Look at this example program:

Bobb  //original quine
Bobby //output (when given an input), we'll name him bobby
Bob   //output (when given a different input), we'll name him bob

The above is not valid, because Bob is only one levenshtein distance from Bobb.

However, this one is valid:

Bob      //original quine
Alice    //bob's output when given 1 as input
Geronimo //bob's output when given 2 as an input

Because \$ ceil(len(bob)/4)=1 \$, and Alice, Geronimo, and Bob are all at more than one levenshtein distance away from each other.

There has to be a minimum of one extra quine to be outputted.

The quine must output itself when given no input or 0, and output a different quine if given a different integer input!

Points

Points are based on this equation (courtesy of Luis felipe De jesus Munoz) $${\frac{100}{\text{bytes}} \cdot 2^{\text{extra quines} - 1}}$$

(100 divided by the number of bytes multiplied by 2 to the power of every different quine that your program can output, minus one to make sure the program at least outputs one different quine)

\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – DJMcMayhem Jan 31 at 16:26
  • \$\begingroup\$ Seems really close to the quine chaining challenge without as good of a specification. \$\endgroup\$ – Magic Octopus Urn Jan 31 at 18:49
  • 2
    \$\begingroup\$ I'm sorry, but this question is still entirely unclear. An extra quine only counts when it is not just appending, deleting or inserting characters into another quine format. That means that the outputs cannot be altercations of each other, nor can they be altercations of the original. Every string is just some other string with characters deleted and/or inserted. So the task would be impossible. And it's not clear what you mean by "altercation". Also, you didn't say anything about polyglots in the spec. \$\endgroup\$ – DJMcMayhem Jan 31 at 20:59
  • \$\begingroup\$ I suggest stating that each quine must be at least n levenshtein distance from each other, where n is a number of your choosing. \$\endgroup\$ – Embodiment of Ignorance Jan 31 at 21:40
  • 1
    \$\begingroup\$ I have created a post on meta for you: codegolf.meta.stackexchange.com/questions/17365/… \$\endgroup\$ – Embodiment of Ignorance Feb 6 at 21:45
1
\$\begingroup\$

JAVA -> ><>, (100/460 bytes)*2^0 = a score of .217... yay

import java.util.Scanner;public class M{public static void main(String args[]){Scanner i=new Scanner(System.in);String s="import java.util.Scanner;public class M{public static void main(String args[]){Scanner i=new Scanner(System.in);String s=%c%s%c;if(i.nextInt()==0){System.out.printf(s,34,s,34,34,34);return;}System.out.println(%c'r3d*d8*7+e0p>>|%c);}}";if(i.nextInt()==0){System.out.printf(s,34,s,34,34,34);return;}System.out.println("'r3d*d8*7+e0p>>|");}}

I'm not winning my own challenge, but this should serve as an example.

If it gets and input of 0 then it outputs the java quine, if it receives a 1 then it outputs a ><> quine (courtesy of mbomb007). And that is it...

\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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