GitHub Migration
This commit is contained in:
20
LICENSE
Normal file
20
LICENSE
Normal file
@@ -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.
|
||||
16
README.md
Normal file
16
README.md
Normal file
@@ -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.
|
||||
9
mkarray.py
Normal file
9
mkarray.py
Normal file
@@ -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])
|
||||
9
prog.txt
Normal file
9
prog.txt
Normal file
@@ -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="")
|
||||
12
quine.py
Executable file
12
quine.py
Executable file
@@ -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="")
|
||||
Reference in New Issue
Block a user