summaryrefslogtreecommitdiff
path: root/sample/trick2018/02-mame
diff options
context:
space:
mode:
Diffstat (limited to 'sample/trick2018/02-mame')
-rw-r--r--sample/trick2018/02-mame/authors.markdown3
-rw-r--r--sample/trick2018/02-mame/entry.rb15
-rw-r--r--sample/trick2018/02-mame/remarks.markdown16
3 files changed, 34 insertions, 0 deletions
diff --git a/sample/trick2018/02-mame/authors.markdown b/sample/trick2018/02-mame/authors.markdown
new file mode 100644
index 0000000000..0e420fdf5d
--- /dev/null
+++ b/sample/trick2018/02-mame/authors.markdown
@@ -0,0 +1,3 @@
+* Yusuke Endoh
+ * mame@ruby-lang.org
+ * cctld: jp
diff --git a/sample/trick2018/02-mame/entry.rb b/sample/trick2018/02-mame/entry.rb
new file mode 100644
index 0000000000..cc4ef9cbc4
--- /dev/null
+++ b/sample/trick2018/02-mame/entry.rb
@@ -0,0 +1,15 @@
+'';eval(r=%q(->z{r="'';eval(r=\
+%q(#{r}))[%q`#{z}`]";i=-040;30.
+times{|n|(15+n%2*15-n/2).times{
+r<<r[i+=(1.-n&2)*(32-n%2*31)]}}
+i=r[524,0]=?\0;eval(r[479..-1])
+c['"']}))[%q`GFEDCBA"+"[e\"'"'t
+kE*;;\";" TRICK2018 ";tb,;{{r
+2E0$ob[us@*0)[90,336])_#i\n}s#i
+0H}>["t]];};o[1,?\n*8];ex"-}eac
+1Hl<1[-1]*2*t=n%2];o[14-n,0)mvk
+8M$<4,?\n];15.times{|n|;o[35ie2
+!Pss.slice!(0,1)+x;sleep(0.0t;0
+'W=%q"<<95<<$s<<95;o=->n,x{n.'1
+;@[2]}|\e../,%@s="'%trick2018!8
+eval$s=%q_eval($s.gsub!(/#{%@`]
diff --git a/sample/trick2018/02-mame/remarks.markdown b/sample/trick2018/02-mame/remarks.markdown
new file mode 100644
index 0000000000..88b32c205a
--- /dev/null
+++ b/sample/trick2018/02-mame/remarks.markdown
@@ -0,0 +1,16 @@
+This program quines with animation.
+
+```
+$ ruby entry.rb
+```
+
+Of course, the output is executable.
+
+```
+$ ruby entry.rb > output
+$ ruby output
+```
+
+Note, we don't cheat. This program uses escape sequences just for moving the cursor. It doesn't use attribution change nor overwrite to hide any code.
+
+The program is crafted so that it works in two ways; it works as a normal program text, and, it also works when it is rearranged in a spiral order. Some parts of the code are actually overlapped.