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
1
vote
2 answers

Quine create and execute file

I am creating a Quine in C and where i need to create a new c file and then compile it and execute it. I made a simple snippet to understand why it's not working. My guess is that execv start the command before fprintf is done writing but i put a…
albttx
  • 3,444
  • 4
  • 23
  • 42
1
vote
2 answers

What is the point of a Quine program?

I just recently learned about Quine programs today in my CS class. I understand that they are programs meant to output there own source code, or "self-reproduce". But what I don't get is, besides being a good test of coding ability and logic, whats…
MooseMan55
  • 524
  • 2
  • 6
  • 21
1
vote
6 answers

Quine Confusion.What actually does quine prints?

Does a quine print the ACTUAL code of the program i.e not obfuscated or does it print the obfuscated program?
user379888
1
vote
0 answers

Self generating bash script

Hi I am trying to create script which will after run copy its content inside another file with different name (time dependent to debugging pruposes) my idea is something like that #!/bin/bash content="printf \"#!/bin/bash\\n%s\" \"$content\" >>…
user4032676
1
vote
2 answers

How does the following quine work?

According to wikipedia : A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output I saw this piece of perl code and am not able to figure out how it works. Save the following line…
enitihas
  • 835
  • 1
  • 9
  • 17
1
vote
1 answer

How does this quine work?

I just came across this quine question, but no one really went into how it works: C/C++ program that prints its own source code as its output char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";main(){printf(s,34,s,34);} What I especially don't…
helloB
  • 3,472
  • 10
  • 40
  • 87
1
vote
0 answers

formatting string for self replication - Javascript

I want to be able to format my string and replicate the same code (not for an attack, but for a demo): window.onload = function() { alert("hello Silly"); var attack = [ 'window.onload = function() {', ' alert("hello…
cybertextron
  • 10,547
  • 28
  • 104
  • 208
1
vote
2 answers

Common-LISP Print function itself

I want to print ,as described in the title, my whole function. (DEFUN X () ...) -> (DEFUN X () ...) What do i need to write in "..." ?
Jordan Zapf
  • 65
  • 1
  • 11
1
vote
1 answer

Str method for python class which reconstitutes the class source

How can I equip a class with a __str__ method which prints the source of the class itself excluding method definitions? I am excluding method definitions because my use-case is that I am dynamically generating fixtures (using the fixtures package;…
Marcin
  • 48,559
  • 18
  • 128
  • 201
1
vote
5 answers

Plus operator - How to enforce String concatenation?

While writing a Quine (i.e. a self-replicating program) in Java, I tried to indent output lines using tab characters: ... char tab = '\t'; char qm = 34; char comma = ','; ... System.out.println(tab + tab + tab + qm + listing[i] + qm +…
chwon
  • 71
  • 4
1
vote
4 answers

C++ add new code during runtime

I am using C++ (in xcode and code::blocks), I don't know much. I want to make something compilable during runtime. for eg: char prog []={"cout<<"helloworld " ;} It should compile the contents of prog. I read a bit about quines , but it didn't…
user2638740
1
vote
1 answer

Are there any other Java quines, besides the one listed on the Wikipedia page?

I know that there is a program code that print itself that is Quine code As the following public class Quine { public static void main( String[] args ) { char q = 34; // Quotation mark character String[] l = { // Array of…
Ahmed Nabil
  • 17,392
  • 11
  • 61
  • 88
0
votes
1 answer

What makes this snippet not a strict quine?

Does someone know why this is not a strict quine ? _0='_0=%r;print _0%%_0';print _0%_0
Johny19
  • 5,364
  • 14
  • 61
  • 99
0
votes
2 answers

How can I write code to show itself

How can I write a code to show itself (print code to console) using standard C++ only without any external library?
Aan
  • 12,247
  • 36
  • 89
  • 150
0
votes
0 answers

Quine–McCluskey to cnf

I have trouble understanding how to get the cnf through the mccluskey algorithm. This is apparently the correct solution (below part) Solution At the top it's done via a kv map and that one makes sense to me (just focus on the zeros) But with the…