Skip to content

A repository which includes a toolkit to generate an n-line quine that remains a quine for all N in as many languages as possible. The goal is to explore under what conditions can we make arbitrarily large quines

License

Notifications You must be signed in to change notification settings

Kernel-Dirichlet/QuineGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

QuineGen

This repository is geared towards collecting examples of quines which remain quines upon copying the source code N times. Additionally, there will be a toolkit to generate N-line quines from templates in a variety of languages. Over time, this repository will showcase how different quine strategies can be used to create programs which not only output themselves, but continue to do so no matter how many times the original source is copied.

While not the primary goal, polyglot quines (programs which are valid in more than one language and themselves are quines simultaneously), and palipolygot quines (polyglot quines which are also palindromes) would be interesting examples to consider.

Background on Quines:

A quine is a self-replicating program - a computer program that takes no input and produces a copy of its own source code as its only output. The term"quine" was coined by Douglas Hofstadter, inspired by the philosopher Willard Van Orman Quine, who made significant contributions to logic and philosophy.

Popular Quine Related GitHub Repositories:

  1. The 128 quine relay: This is the largest quine relay project where 128 languages are used to generate a quine from the original source language, but with the logic encoded and passed through each of the 128 languages. The quines do not have the restriction that they must remain valid if copied N-times - GitHub Link: 128 quine relay

  2. Snake over Quine: This repository showcases a unique C++ quine which serves as a background for the popular game "Snake"

Significance of Generating Quines of Arbitrary Length:

Generating quines of arbitrary length highlights significant properties of a given language. Here's why it's significant:

  • Algorithmic Complexity: Writing a quine that can self-replicate is already a non-trivial task. However, as the length of the quine increases, the complexity of the algorithm required to generate should increases significantly. Even though this is true, the examples in the repository often feature "standard" quine techniques which are sufficient to generate programs of arbitrary length.

  • Demonstration of Language Features: Writing quines of varying lengths can demonstrate the capabilities and limitations of different programming languages. Some languages may offer features or constraints that make quine generation easier or more challenging, which can serve as a proxy for gauging its metaprogramming capabilities and limitations.

  • LLM "testing": As of the current date (3/11/2024), many LLMs, even GPT4, struggle generating quines in even simpler scripting languages, let alone with the additional constraints of polyquines and arbitrary length quines.

  • Because we can: Much like many code golf related tasks, we simply can push the boundaries of what is possible.

Contributing to this Repository

  • This repository will have automated tests that will check all quines submitted to the quines template are indeed quines and remain so when copied N-times. For now, interesting examples (quines that feature techniques not pulled from StackExchange or elsewhere) take priority.

How-to Guide

The n-line quine generator works from the command line, simply follow the arguments templates below. This will remain consistent.

git clone https://github.com/Kernel-Dirichlet/QuineGen
cd /QuineGen/src
python nline_quine.py --lines <number_of_lines> --lang <language> --template <template_tag>

Example:

python3 nline_quine.py --lines 50 --lang python --template exec 

About

A repository which includes a toolkit to generate an n-line quine that remains a quine for all N in as many languages as possible. The goal is to explore under what conditions can we make arbitrarily large quines

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages