aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-08-09 02:23:19 +0900
committernsfisis <nsfisis@gmail.com>2023-08-09 02:23:50 +0900
commit31cf15c2668253bc3c6b0efff9c76b9fb1cb3703 (patch)
tree1ed585fd7c3faffe409305792ed31b4ea390139e
parent72ae324435b6f2a7371c3bd01a2e1ec19450fc55 (diff)
downloadtwitter2x-quine-31cf15c2668253bc3c6b0efff9c76b9fb1cb3703.tar.gz
twitter2x-quine-31cf15c2668253bc3c6b0efff9c76b9fb1cb3703.tar.zst
twitter2x-quine-31cf15c2668253bc3c6b0efff9c76b9fb1cb3703.zip
quine
-rw-r--r--.gitignore4
-rw-r--r--q.rb23
-rw-r--r--test.sh8
3 files changed, 35 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0dc05a8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/1.rb
+/2.rb
+/3.rb
+/4.rb
diff --git a/q.rb b/q.rb
new file mode 100644
index 0000000..f6324d2
--- /dev/null
+++ b/q.rb
@@ -0,0 +1,23 @@
+ k=1;eval( s=
+ ( %w{s="k=#{1-k};eval
+ (s=( %w{#{s}})*'')";s+=";
+ %q\x5f "+s;i=f=0;puts([%|B*(#~%
+ ":4~$%65~ $'39~$*/8~$-,6~%1'6~&K~
+ (I~$L~%K~'H~ (G~*D~'F~)C~+@~.<~17~
+ .8~);~$=~(5|,%|" 0A)~"&''=)~#'''9)~%''
+ '5)~''''1)~)'''-)~+'''))~-'''%)~/''/~1''+~
+ 3'''~5'''~7'''~7)''~5-''~3)#'''~1)''''~/
+ )+'''~-)/'''~+)3'''~))7'''~');''&~%)?0|,][k
+ ].tr("~","\n").gsub(/./){n=$&.ord-33;(f=!f
+ )?s[(i+=n)-n,n]:"\40"*n}+"_")})*'');%q_
+ k=1;eval(s=(%w{s="k=#{1-k};eval(s=(%w{
+ #{s}})*'')";s+=";%q\x5f"+s;i=f=0;pu
+ ts([%|B*(#~%":4~$%65~$'39~$*/8~$-,6~%
+ 1'6~&K~(I~$L~%K~'H~(G~*D~'F~)C~+@~
+ .<~17~.8~);~$=~(5|,%|"0A)~"&''=
+ )~#'''9)~%'''5)~''''1)~)'''
+ -)~+'''))~-'''%)~/''/~
+ 1''+~3'''~5'''~7'''~7)'
+ '~5-''~3)#'''~1)''''~/)+''
+ '~-)/'''~+)3'''~))7'''~');''
+ &~%)?0|,][k].tr("~",_
diff --git a/test.sh b/test.sh
new file mode 100644
index 0000000..abcc879
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,8 @@
+rm -f {1,2,3,4}.rb
+ruby q.rb > 1.rb
+ruby 1.rb > 2.rb
+ruby 2.rb > 3.rb
+ruby 3.rb > 4.rb
+
+diff 1.rb 3.rb || echo err
+diff 2.rb 4.rb || echo err