diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-11 14:37:06 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-11 14:37:06 +0000 |
commit | 5c28308f9fbb44bfc73fe8af58fdcce0ad0379f2 (patch) | |
tree | b096f65a2e92c00028406ba988cd5e55094ab2f4 /sample/trick2015/monae | |
parent | d65bc80d3f71bf5423a6a6d9b3f8d4ff2faf6bd5 (diff) | |
download | ruby-5c28308f9fbb44bfc73fe8af58fdcce0ad0379f2.tar.gz |
* sample/trick2015/: added the award-winning entries of TRICK 2015.
See https://github.com/tric/trick2015 for the contest outline.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/trick2015/monae')
-rw-r--r-- | sample/trick2015/monae/authors.markdown | 1 | ||||
-rw-r--r-- | sample/trick2015/monae/entry.rb | 26 | ||||
-rw-r--r-- | sample/trick2015/monae/remarks.markdown | 25 |
3 files changed, 52 insertions, 0 deletions
diff --git a/sample/trick2015/monae/authors.markdown b/sample/trick2015/monae/authors.markdown new file mode 100644 index 0000000000..58d63b16ac --- /dev/null +++ b/sample/trick2015/monae/authors.markdown @@ -0,0 +1 @@ +monae (@monae, jp) diff --git a/sample/trick2015/monae/entry.rb b/sample/trick2015/monae/entry.rb new file mode 100644 index 0000000000..9524086b29 --- /dev/null +++ b/sample/trick2015/monae/entry.rb @@ -0,0 +1,26 @@ + ;; ;; ;; ;;
+ ;; ;; ;; ;;
+ ;;eval$s =%q[i=1#
+ eval(%q[ xxxxxxxx
+ xx xxxx xx xx xxxx xx
+ xx xxxx xx xx xxxx xx
+ xxxxxxxx xxxxxxxx
+ xxxxxxxx xxxxxxxx
+ xx xx xxxxxxxxxx xx xxxxxxxx
+ j, t, p=0,[?;]," ev al$s=%qx
+[#$s]".split*"";i,j,t=i-j,i+j,(x
+ [b=?\s]*j.abs+t).map{|s|r=t.shix
+ft ||b;r.gsub!(?;){p.slice!0}if $x
+ f| |=p>p=p.center(i*i+j*j,?;);r ,x
+ s=[s,r]if(i*j<0);(b*i.abs+s).ljx
+ ust(r.size).gsub(b){r[$`.size]|x
+ |b}}unti l$ f;puts(t)# xx xx
+ xxxxxxxx xx xxxxxxxxxx xx xx
+xxxxxxxx xxxxxxxx
+ xxxxxxxx xxxxxxxx
+xx xxxx xx xx xxxx xx
+ xx xxxx xx xx xxxx xx
+ xxxxxxxx x].gsub\
+ /x.*|\s/ ,"")#];;
+ ;; ;; ;; ;;
+ ;; ;; ;; ;;
diff --git a/sample/trick2015/monae/remarks.markdown b/sample/trick2015/monae/remarks.markdown new file mode 100644 index 0000000000..48be61bd12 --- /dev/null +++ b/sample/trick2015/monae/remarks.markdown @@ -0,0 +1,25 @@ + +# How to run + +``` +ruby entry.rb +ruby entry.rb | ruby +ruby entry.rb | ruby | ruby +ruby entry.rb | ruby | ruby | ruby +... +``` + +Confirmed on the following environments: +- ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14] +- ruby 2.0.0p353 (2013-11-22) [i386-mingw32] + +# Description + +A simple quine which prints itself twice +on a slightly complex base. + +> geminum caput amphisbaenae, hoc est et a cauda, +> tamquam parum esset uno ore fundi venenum. +> aliis squamas esse, aliis picturas, omnibus exitiale virus. +> +> — <cite>GAIUS PLINIUS SECUNDUS, Naturalis Historia 8.85.1</cite> |