commit 490594826bdffa76759b3367dd428642b027492f Author: rarmknecht Date: Fri Dec 19 18:00:07 2025 -0600 GitHub Migration diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5dcb9db --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fef426 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +SimpleQuine +=========== + +A Simple Quine in Python. + + - quine.py: This is the completed python quine file + - prog.txt: This is the "core" portion of quine.py that will parse the array and print either the number or cast it as a character and print that. + - mkarray.py: This file reads in prog.txt and generates the array for quine.py. + +This quine has three parts: + + 1. Data Array + 2. Print the Data Array + 3. Print the Data Array cast as Characters + +Important to note that 3 results in the code required to perform 2 & 3. 1 is created with the helper file mkarray.py. diff --git a/mkarray.py b/mkarray.py new file mode 100644 index 0000000..cd1766d --- /dev/null +++ b/mkarray.py @@ -0,0 +1,9 @@ +#!/usr/bin/python + +file = open('prog.txt','r') + +s = "" +for b in file.read(): + s+="%d," % ord(b) + +print(s[:-1]) diff --git a/prog.txt b/prog.txt new file mode 100644 index 0000000..c020ddd --- /dev/null +++ b/prog.txt @@ -0,0 +1,9 @@ +print("#!/usr/bin/python\n\nd=[", end="") +s="" +for n in d: + s+="%d," % n +print(s[:-1],end="") +print("]\n",end="") + +for c in d: + print("%c" % c, end="") diff --git a/quine.py b/quine.py new file mode 100755 index 0000000..b9336e8 --- /dev/null +++ b/quine.py @@ -0,0 +1,12 @@ +#!/usr/bin/python + +d=[112,114,105,110,116,40,34,35,33,47,117,115,114,47,98,105,110,47,112,121,116,104,111,110,92,110,92,110,100,61,91,34,44,32,101,110,100,61,34,34,41,10,115,61,34,34,10,102,111,114,32,110,32,105,110,32,100,58,10,9,115,43,61,34,37,100,44,34,32,37,32,110,10,112,114,105,110,116,40,115,91,58,45,49,93,44,101,110,100,61,34,34,41,10,112,114,105,110,116,40,34,93,92,110,34,44,101,110,100,61,34,34,41,10,10,102,111,114,32,99,32,105,110,32,100,58,10,9,112,114,105,110,116,40,34,37,99,34,32,37,32,99,44,32,101,110,100,61,34,34,41,10] +print("#!/usr/bin/python\n\nd=[", end="") +s="" +for n in d: + s+="%d," % n +print(s[:-1],end="") +print("]\n",end="") + +for c in d: + print("%c" % c, end="")