Questions tagged [quine]

A program that generates a copy of its own source text as its complete output (generally of interest in theory only).

A program that generates a copy of its own source text as its complete output. This is generally considered of interest in theory only; but highly self-contained programs ( for example) may be viewed as quine-like. Named after the logician Willard van Orman Quine

99 questions
0
votes
2 answers

Javascript: Execute and Quine at the same time

I have a bizarre need here, and I am unsure of it's feasibility. I can only think how I would do it using threads (To create another thread that performs a Quine function along side a thread running the script I want to Quine and execute at the same…
Matt
  • 351
  • 1
  • 5
  • 15
0
votes
1 answer

Printing out backslash in C quine program

I'm trying to write a quine program for the follow C source code: #include char name[] = "Jacob Stinson"; int main(){ char *c="#include char name[] = \"Jacob Stinson\"; int main(){char *c=%c%s%c;…
Jacob Stinson
  • 181
  • 1
  • 16
-1
votes
1 answer

Is there a way for the value of an object to be made aware of its own key dynamically?

This is a purely theoretical question here (though one I think is an interesting thought exercise). I was just working on a JavaScript object (documentation-related) and the somewhat-unusual thought crosses my mind: is there a way to make a…
NerdyDeeds
  • 343
  • 1
  • 11
-1
votes
1 answer

I wrote a C program that embeds its own source code at compile time and displays it at runtime. Does this count as a quine?

#include extern const char source[]; int main() { printf("%s", source); return 0; } asm( ".section .rodata\n" ".global source\n" "source:\n" ".incbin \"" __FILE__ "\"\n" ".byte 0\n" ); Wikipedia says a quine…
flarn2006
  • 1,787
  • 15
  • 37
-1
votes
1 answer

Display the value of a variable in itself

I am doing a quine in Ruby that will display its own code in a new file. I'm trying to do like the following to print the variable itself in the new file: $var = "Some Code%c$var = %c%s%c % [10,34,$var,34,10]%cSome Code" % [10,34,$var,34,10] The…
user7436433
-1
votes
1 answer

Python: What does the two % signs in print '%r k%%k'%'a' do?

I came across this while researching quines. I am curious to know what %% does in the following print '%r k%%k'%'a' I understand that %r takes the string representation of the argument that's passed (in this case 'a') and adds it to the string with…
max_max_mir
  • 1,494
  • 3
  • 20
  • 36
-3
votes
1 answer

Can anyone help me complete this quine in Ruby? - I'm so very close

s="s=@;print(s.sub('@', s))";print(s.sub('@', "\"#{s}\"")) This code is supposed to print out an exact copy of itself but instead I am getting the following: s="s=@;print(s.sub('@', s))";print(s.sub('@', s))% It's almost there but the problem I'm…
user3895395
  • 471
  • 4
  • 16
-4
votes
1 answer

Shortest quine in Kotlin?

What's the shortest quine written in Kotlin language? See my implementation in answers, but I believe a shorter one exists.
Vadik Sirekanyan
  • 3,332
  • 1
  • 22
  • 29
-5
votes
1 answer

How to write output compiler in java?

Is there a way to make a quine in java, then have some sort of program recognize the output as a program, then run that and give an output, and keep on doing so infinitely? I'm trying to write a self-replicating code and get it to infinitely…
1 2 3 4 5 6
7