Slide 1

Slide 1 text

TRICK 2018 FINAL Results TRICK judges: mame, eto, shinh, yhara, matz, leonid, eban Transcendental Ruby Imbroglio Contest for RubyKaigi

Slide 2

Slide 2 text

Transcendental Ruby Imbroglio Contest for RubyKaigi What’s “TRICK” • A contest for “esoteric” Ruby programming – The most "strange" Ruby program wins – Ruby version of IOCCC (International Obfuscated C Code Contest) Transcendental /ˌtransɛnˈdɛnt(ə)l/ “relating to a spiritual realm” * 「霊的領域に関する」 「世俗を超越した」「超絶技巧」 Imbroglio /ɪmˈbrəʊlɪəʊ/ “an extremely confused, complicated, or embarrassing situation” * 「極めて混乱した、恥ずかしい事態」 * Oxford Dictionaries

Slide 3

Slide 3 text

The story so far • TRICK 2013: “Best pangram” by @kinaba • TRICK 2015: “Best piphilology” by @kinaba • TRICK 2018 is the 3rd and final(!) contest !@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz&[%r{¥"}mosx, 4>6]|?'while(putc 3_0-~$.+=9/2^5;)<18*7and:`# This prints each printable ASCII character exactly once. This contains each printable ASCII character exactly once. big , temp = Array 100000000 ** 0x04e2 3 1 4 1 5 . 9 2 6 …

Slide 4

Slide 4 text

This talk • We held TRICK 2018 FINAL (2018/01/01 – 03/31) • We announce the winners of TRICK 2018

Slide 5

Slide 5 text

About TRICK 2018

Slide 6

Slide 6 text

Judges Yusuke Endoh (@mametter) Koichiro Eto (@eto) Shinichiro Hamaji (@shinh) Yutaka Hara (@yhara) Yukihiro Matsumoto (@yukihiro_matz) Sun Park (@sunleonid) Hirofumi Watanabe (@eban)

Slide 7

Slide 7 text

Judges eto – Media Artist. – Chairman at NicoNicoGakkai Beta. shinh – The admin of anarchy golf. – IOCCC winner. yhara – The author of Japanese esolang book. matz – The creator of Ruby. leonid – The 1st super Ruby golfer. eban – The 2nd super Ruby golfer. – Full-time Ruby committer at Cookpad. – The world’s No.1 IOCCC player. mame

Slide 8

Slide 8 text

Submission statistics • Thank you for all the submitters! (I’m using 3D pie charts here to obfuscate the precise number of submissions.) JP US DE PL BE

Slide 9

Slide 9 text

Honorable mentions • Best monkey - Tomoya Ishida (tompng) • Best abuse of lambda - Shinichiro Hamaji • Best abuse of meta - Yuki Yugui Sonoda • Most solvable - Don Yang • Best layout - Yutaka HARA • Best abuse of regexp - Benoit Daloze (eregon) • Most tolerant - Shuichi Tamayose • Best applause - Colin Fulton – Enjoy these entries yourself

Slide 10

Slide 10 text

CAUTION • From here, this talk has a lot of spoilers! – Exit now if you want to enjoy analyzing the winners • The winning entries will be published at: No k! http://github.com/tric /trick2018/

Slide 11

Slide 11 text

Winners & Judges' Prizes

Slide 12

Slide 12 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Most warned” 『最も警告されたで賞』 kinaba (JP) 13th & yhara award N/A 5 7 3 7 4 N/A 5.20

Slide 13

Slide 13 text

kinaba.rb • A ten-line program • It prints "TRICK2018" 13th & yhara award “Most warned” def STDOUT.write (s); syswrite s end if def $>.write; end s = Array.new(){}.map{|s|} s << (-"Trick").grapheme_clusters{} [0] # frozen_string_literal: Trick s << ("Ruby".unpack *"ao") [0] s << "#{10**2018 + 1e2018}" [0] s << "#{1>2>3 rescue $!.class.trust.class}"[0] s << "#{true; Kernel.public_class_method}" [0] s << ($ruby.object_id.coerce +2018) [0] result = puts s*"" $ ruby kinaba.rb TRICK2018

Slide 14

Slide 14 text

kinaba.rb - Spoiler 13th & yhara award “Most warned” $ ruby –w kinaba.rb -:1: warning: parentheses after method name is interpreted as an argument list, not a dec -:2: warning: mismatched indentations at 'end' with 'def' at 1 -:3: warning: shadowing outer local variable - s -:4: warning: `frozen_string_literal' is ignored after any tokens -:5: warning: `*' interpreted as argument prefix -:6: warning: Float 1e2018 out of range -:7: warning: comparison '>' after comparison -:8: warning: unused literal ignored -:9: warning: ambiguous first argument; put parentheses or a space even after `+' operato -:10: warning: assigned but unused variable - result -:1: warning: method redefined; discarding old write -:2: warning: previous definition of write was here -:3: warning: given block not used -:4: warning: passing a block to String#grapheme_clusters is deprecated -:5: warning: unknown unpack directive 'o' in 'ao' -:6: warning: Bignum out of Float range -:7: warning: trust is deprecated and its behavior is same as untaint -:8: warning: public_class_method with no argument is just ignored -:9: warning: global variable `$ruby' not initialized -:10: warning: #>.write is outdated interface which accepts just one argument TRICK2018 Each line has static (parse/compile-time) warnings Each line also has dynamic (run-time) warnings

Slide 15

Slide 15 text

kinaba.rb - Spoiler • yhara's comment • kinaba's comment 13th & yhara award “Most warned”

Slide 16

Slide 16 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Minimum alternative of irb” 『最小の irb 代替物で賞』 Jan Lelis (DE) 12th & mametter award N/A 2 8 6 6 6 N/A 5.60

Slide 17

Slide 17 text

jan.rb 12th & mametter award “Minimum alternative of irb” eval %w?_="";_ _=binding;l oop( )do $>< <"> >¥s "if $/> _;p uts "=> ¥s%p "%[ __.e val (_+ =get s||exit!) ,_=""];rescu e(Ex cep tio n); put s""+ "¥e [31 m%p ¥e[ 0m"% [$! ,_= ""] if/ d¥se |ee /!~ "#$!"end?*""

Slide 18

Slide 18 text

jan.rb - Spoiler • Serves as an interactive Ruby interpreter – Colors an error message – Supports line continuation 12th & mametter award “Minimum alternative of irb” $ ruby jan.rb >> 1 + 2 => 3 >> foo #> "Hello," + "world" => "Hello,world"

Slide 19

Slide 19 text

jan.rb - Spoiler • Highlight: How to detect line continuation – Try to evaluate the input lines – If it throws an exception, and if its message matches: – the input is considered "unterminated yet" • This Regexp determines if the error is either: 12th & mametter award “Minimum alternative of irb” /d e|ee/ syntax error, unexpected end-of-input unterminated string meets end of file syntax error, unexpected end-of-input unterminated string meets end of file

Slide 20

Slide 20 text

jan.rb - Spoiler • mametter's comment – I believe this is the ever shortest implementation of interactive ruby program. – Both the implementation technique and its appearance are so smart. – Thank you for the great program! • Jan's comment 12th & mametter award “Minimum alternative of irb”

Slide 21

Slide 21 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Most attractive” 『最も魅力的で賞』 Tomoya Ishida (tompng) (JP) 11th & eto award 5 10 8 4 9 8 3 6.71

Slide 22

Slide 22 text

tompng.rb 11th & eto award “Most attractive” p,i,u,f,v,q ,h,x=[], Math,->x{i.sin x},->x,y,z{ x*=1.2; r,a,m=(1 -y=y*1.4+0.15)/2+0.1,y+u[3*x+4*y+5*z*=1.2] /12,x* x+z*z; l,s,b= m**0.5,i.atan2(z,x),u[6*a]**2/36+((x*x+z*z)**0.5-r)** 2-(1- a* a)/2 /500;l-= (1-y )/8 *d= (u[ 2*s +3*3*t =1-y- l/2]* u[ 3* s-3*2 * t]) **2/( 1+i. exp( t *10- 9- 5.5 ));e =4*l /( 1+( 0.01+ (1-a=y-d* ( 1 -y) /8)** 2)**0.5 -a)*(1-a * a+((1- a*a)**2+ 0.01 )** 0.5 )** 0.5 ;(i.atan( (1-0.2*i. asin( 0.98* u[+ +5.0 * i. atan2(y= 3*y-3.4,x *=3)] ))*( (0.01+x*x+ y*y )** 0.5-0.1) +4*(0.01+z *z*4 )**0.5-1)* i.atan( a*a+e*e-1-10/(1+(40*m)**10+((a+1)*10)**10))-0.01)*b},%w& MMM## TTTQQBKPTVVpQAk5Y7*pgw43v7*pgaor<*"ggau]/~"gau];-~'ga;,,,.'MerryChristmas!&*'',->x ,y,z, s,m{if(m== 1);g=f [x+=s/2,y+=s/2,z+=s/2];a, b,c=f[x+d=0.01,y,z]-g,f[x,y+d,z]- g,f[x, y,z+d] -g; p<<[x,y,z,a/d=(a*a+b*b+c *c)**0.5,b/d,c/d];else;(r=0 ...n=[m,4].min).map{|i|r.map{ |j|a, b=[f[ x+k =s*i/n,y+l=s*j/n,z+s],f [x+k,y+l,z],f[ x,y+k,z+l],f[x+l,y,z+k],f[x+s,y+k,z+l],f[x+l,y++s, z+k]]. minmax;return 8. times { | i|q[x + s * i [0],y+s *i[1] ,z+s* i[2], s,m/2]}if a*b <0 && s/= 2 }} ; end}, 0,1 .. j=128 (0..7) .each{|i|q[i[ 0] -z= 1.0,i[1 ]-z ,i[2] -z,z,64] ; $><< v[2 *i+64 ,2]};;; sleep 1;loop{ r,s ,m, l,d, w=i.cos( h+=0.02 ),u[ h],i.cos( m= u[ 2.3 *h ]/5),u [++m], x.map {[7]*j}, x. map {[7] *j};;p. each{| x,y ,z,a,b, e| x, z=x *r +s*z,z *r-s* x;y,z =m*y+ l*z ,m *z -l*y;x, y=64* (x+ 1 ),64 *( 1- y ) ;x<<27.chr+ ?[+f* ';'+?H+(0..63) .map{|y|x.map{|x| v[w[x-=1 ][2*y]*8+w[x][2*y+ 1]]}.join}*$/}

Slide 23

Slide 23 text

tompng.rb - Spoiler 11th & eto award “Most attractive”

Slide 24

Slide 24 text

tompng.rb - Spoiler 11th & eto award “Most attractive” • 3D rendering of X'mas tree in terminal • eto's comment • tompng's comment

Slide 25

Slide 25 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Best double meaning” 『最高のダブルミーニングで賞』 Tomoya Ishida (tompng) (JP) 10th & matz award 5 3 10 7 7 8 8 6.86

Slide 26

Slide 26 text

tompng2.rb 10th & matz award “Best double meaning” • Works as a FizzBuzz-like program $ ruby tompng2.rb 1 2 Ruby 4 Trick Ruby 7 8 Ruby Trick…

Slide 27

Slide 27 text

tompng2.rb 10th & matz award “Best double meaning” • Looks like a FizzBuzz program … def fizzbuzz n set_error 'wrong argument type' if n.nil? if n < ​ 0 n = -n​ retval =​ fizzbuzz n return ​ ​ ​ ​ ​ retval else …

Slide 28

Slide 28 text

tompng2.rb - Spoiler 10th & matz award “Best double meaning” • Contains many Unicode spaces … def ■ fizzbuzz■n set_error 'wrong argument type' if n.nil? if n < ◆0 n = -n​ ◆ retval =​ ◆ fizzbuzz■n return ​ ​ ◆◆◆◆◆ retval else … ■:U+00A0 No-break Space ◆:U+200B Zero Width Space

Slide 29

Slide 29 text

tompng2.rb - Spoiler 10th & matz award “Best double meaning” • Looks like a fizzbuzz, and is actually a fizzbuzz • However, the interpretation is completely different than we expect – For example, is not an integer negation, but calls String#-@ (freeze) • Of course, if all Unicode spaces are removed, it also works correctly as we expect! n = -n

Slide 30

Slide 30 text

tompng2.rb - Spoiler 10th & matz award “Best double meaning” • matz's comment – Rubyは見栄えに気を使う言語です。コードがどのように見 えるか、やりたいことが簡潔に表現できていて、余計なもの を書かずに済むように言語デザイン的に工夫されていま す。しかし、本作品はスペースを有効(?)活用することで、 見栄えと動作を分離することに成功しています。Rubyのパ ワーのひとつの源である「濫用可能な文法」の極致を堪能し てください。 • tompng's comment

Slide 31

Slide 31 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Most (un)readable” 『最も読みやすい(読みにくい)で賞』 Yutaka HARA (JP) 9th 7 10 7 7 N/A 6 5 7.00

Slide 32

Slide 32 text

yhara.rb 9th “Most (un)readable” • A Quine that explains how to work in Japanese def method_missing(n);$*<

Slide 33

Slide 33 text

yhara.rb - Spoiler 9th “Most (un)readable” *自己言及的なプログラム. これは「自己に言及」したQuineプログラムです. 動かすには普通に無引数で実行してください. MRIの最新の安定版で動作確認を行っています. byte length 36 62 60 60 $ > < < ASCII code method calls (hooked by method_missing) eval'ed code $><

Slide 34

Slide 34 text

yhara.rb 9th “Most (un)readable” • yhara's comment

Slide 35

Slide 35 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Best compiler” 『最高のコンパイラで賞』 Tomoya Ishida (tompng) (JP) 8th 7 2 9 9 8 9 7 7.29

Slide 36

Slide 36 text

tompng3.rb 8th “Best compiler” (B||=[])<<6;C||=[];C<<%w@0 if@; a=?;*2018;C<<%w@2 (e=ARGV[0]);e=File.read@; t=->(i,s){s&&a[i.to_i,s.size]=s};C<<%w@25 (e)if@; u=->{C.map{|i,s|t[i,s]};eval(a)};C<<%w@30 (/^¥.+$@; at_exit{_,u=u,->{};_[]};C<<%w@37 /!~e&&File.exist?(@; C<<%w@55 e));d='[><+-,.]';i=32.chr;f=0..79;c=(0..7).m@; C<<%w@99 ap{|c|b=['C||=[];','a=?;*2018;','t=->(i,s){s@; C<<%w@143 &&a[i.to_i,s.size]=s};','u=->{C.map{|i,s|t[i,@; C<<%w@188 s]};eval(a)};','at_exit{_,u=u,->{};_[]};'];o=@; C<<%w@233 0;f.map{|f|j=(0..67).map{|r|r-=34;s=f-34;m,n=@; C<<%w@278 r.abs,s.abs;h=->x{m<25&&n<34&&(x<0||n>17)};q=@; C<<%w@323 ->x{n37&&s>17-r&&4*s<173-r),r**4+16*(s-25)@; C<<%w@458 **4<8*17**4,h[-r]][c]};r,p=j.index(!!0),j.cou@; C<<%w@503 nt(!!0);next(i*68)if(!r);k=f==45?'(B||=[])<<'@; C<<%w@548 +c.to_s+?;:'';g=b[0];(k+=b.shift)if(g&&g.size@; C<<%w@593 <=p-k.size);l=p-k.size-o.to_s.size-9;s=64.chr@; C<<%w@638 ;if(l>0);k+=['C<<%w',s,o,i,a[o,l],s,?;]*'';o+@; C<<%w@683 =l;end;(i*r)+k+?;*([p-k.size,0].max)+i*(68-r-@; C<<%w@728 p)}};(e.chars-(e.chars-d.chars)).each_slice(8@; C<<%w@773 ){|l|puts(f.map{|y|l.map{|r|c[d.index(r)][y]}@; C<<%w@818 .*(i*17).rstrip});4.times{puts};};else;x,i=@; C<<%w@861 Hash.new{0},0;y=%(while(x[i]!=0);i+=1;i-=1;@; C<<%w@904 x[i]+=1;x[i]-=1;x[i]=($<.binmode.getc||0)@; C<<%w@945 .ord;$><<(x[i]&0xff).chr;end).split(?;)@; C<<%w@984 ;eval(B.map{|a|y[a]}*?;);end;;;;;;;;;@; C<<%w@1021 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;@; C<<%w@1051 ;;;;;;;;;;;;;;;;;;@;

Slide 37

Slide 37 text

tompng3.rb - Spoiler 8th “Best compiler”

Slide 38

Slide 38 text

tompng3.rb - Spoiler 8th “Best compiler” • Brainf*ck to Ruby compiler ✓ The Ruby code works as the original Brainf*ck code ✓ The Ruby code shapes like the original Brainf*ck code ✓ The Ruby code works as the compiler if a file is given ✓ (Hard-coded font data is cute) ++++[->+ +++[->++ +++++>++ +<<]<]>> compile Brainf*ck code Ruby code

Slide 39

Slide 39 text

tompng3.rb - Spoiler 8th “Best compiler” • tompng's comment

Slide 40

Slide 40 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Most composable” 『最も組合せ可能で賞』 Colin Fulton (US) 7th & shinh award & leonid award 5 4 9 10 9 10 4 7.29

Slide 41

Slide 41 text

justcolin.rb 7th & shinh award & leonid award “Most composable” $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}]

Slide 42

Slide 42 text

justcolin.rb - Spoiler 7th & shinh award & leonid award “Most composable” $l||=__LINE__;eval q=%q[k =";eval q=%q";$l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ################ (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s="");$r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%;;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&&(y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42;e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)};h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&&(r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!||c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}};g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr};x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$;b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) &&(v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]};w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]};$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}];at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q"; $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}] ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}]

Slide 43

Slide 43 text

justcolin.rb - Spoiler 7th & shinh award & leonid award “Most composable” $l||=__LINE__;eval q=%q[k =";eval q=%q";$l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ################ (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s="");$r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%;;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&&(y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42;e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)};h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&&(r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!||c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}};g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr};x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$;b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) &&(v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]};w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]};$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}];at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q";$l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ################ (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s="");$r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%;;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&&(y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42;e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)};h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&&(r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!||c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}};g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr};x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$;b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) &&(v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]};w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]};$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}];at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}]

Slide 44

Slide 44 text

justcolin.rb - Spoiler 7th & shinh award & leonid award “Most composable” $l||=__LINE__;eval q=%q[k =";eval q=%q";$l||=__LINE__;eval q=%q[k =";eval q=%q";$l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ################ (c) 2018 (MIT License) ################ (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s="");$r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s="");$r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%;;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%;;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&&(y=->{z=puts(z.map &:rstrip)})&&(s="")&&(y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42;e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42;e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)};h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)};h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&&(r||=->{f[$r.flat_map{|a|f[a,9]},81]})&&(r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!||c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!||c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}};g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}};g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr};x=->{"$l||=__LINE__"+k+91.chr+q+93.chr};x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$;b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$;b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) &&(v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) &&(v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]};w=->i{z ?z.zip(v[i]) .map(&:join):v[i]};w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]};$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]};$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}];at_exit{b=b&&($z||81.times(&u)&&$z=1)}];at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}]

Slide 45

Slide 45 text

justcolin.rb - Spoiler 7th & shinh award & leonid award “Most composable” $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q";$l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ################ (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s="");$r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%;;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&&(y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42;e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)};h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&&(r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!||c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}};g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr};x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$;b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) &&(v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]};w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]};$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}];at_exit{b=b&&($z||81.times(&u)&&$z=1)}] $l||=__LINE__;eval q=%q[k =";eval q=%q"; $l||=__LINE__;eval q=%q[k =";eval q=%q"; ######## (c) 2018 (MIT License) ######## ######## (c) 2018 (MIT License) ######## ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 ;n=([1]);f=->s{[0]*(s.size/40)};$c||=-17 $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); $r=[*$r]+[[]]*(($l-$c)/18);$c=$l;(s=""); ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;m=->a,b{8+4*a[b]};$r[ -1]+=f[s]+n;s=%; ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z ;;s&&$r[-1]=f[s]+$r[-1]||(z=44);z=$l=s=z (y=->{z=puts(z.map &:rstrip)})&&(s="")&& (y=->{z=puts(z.map &:rstrip)})&&(s="")&& e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; e=->a,b,c{(a+a)[b+c]+a[b-c]};$r||=$r*42; ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} ;h=[1,*8..10];f=->a,l{a+[0] *(l-a.size)} (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& (r||=->{f[$r.flat_map{|a|f[a,9]},81]})&& c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| c=->a,d{h.map{|p|e[a,d,p]}.sum};!nil.!|| g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; g=->a{d=-1;a. map{(m[a,d+=1])[c[a,d]]}}; ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} ;x=->{"$l||=__LINE__"+k+91.chr+q+93.chr} b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; b=->{x[].split(?¥n).map{|s|s[$t]}}||!$$; (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && (v=->i{g[r[]][i]>0?b[]: [" "*40]*18}) && w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; w=->i{z ?z.zip(v[i]) .map(&:join):v[i]}; ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;$t=/¥S.{0,39}/;u=->i{z=w[i];i%9>7&&y[]} ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}] ;at_exit{b=b&&($z||81.times(&u)&&$z=1)}]

Slide 46

Slide 46 text

justcolin.rb - Spoiler 7th & shinh award & leonid award “Most composable” • Works as a cell of "the Game of Life" – You can copy and paste it as a cell – The composed program print the next generation • Highlight: How to detect which cell is filled or not – Y-coordinate: – X-coordinate: • Another highlight: Very fragmented code – To make it vertically composable, no block ranges multi- line __LINE__ ;;……s=%; (spaces) ;;……s=%;

Slide 47

Slide 47 text

justcolin.rb - Spoiler 7th & shinh award & leonid award “Most composable” • leonid's comment – Box-shaped code that can stack: Fascinating. – It's also a quine: Incredible. – It's a dot in the Game of Life: AMAZING! • shinh's comment • justcolin's comment

Slide 48

Slide 48 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Most reversible” 『最もリバーシブルで賞』 Yusuke Endoh (JP) 6th & eban award 9 7 N/A 9 8 8 4 7.33

Slide 49

Slide 49 text

mame.rb 6th & eban award “Most reversible” • A sorting program a,b=:reverse,:itself;b=b a=b=:itself;b r||=->s,m=a{s.send(m)};a puts r[$<.sort_by(&r),b] ;r||=->s,m=a{s.send(m)}; a=b=:reverse;0 b,a=:reverse,:itself# $ cat input.txt 3 2 1 $ ruby mame.rb input.txt 1 2 3

Slide 50

Slide 50 text

mame.rb - Spoiler 6th & eban award “Most reversible” – yields a reverse-sort program – yields a program that sorts by reversed lines – yields a program that reverse-sorts by reversed lines – yields the original sorting program ruby mame.rb mame.rb > rsort.rb ruby rsort.rb rsort.rb > sortr.rb ruby sortr.rb sortr.rb > rsortr.rb ruby rsortr.rb rsortr.rb > mame2.rb

Slide 51

Slide 51 text

mame.rb - Spoiler 6th & eban award “Most reversible” • eban's comment • mame's comment

Slide 52

Slide 52 text

Top five awards

Slide 53

Slide 53 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Most three-dimentional” 『最も立体的で賞』 Tomoya Ishida (tompng) (JP) 8 8 8 6 9 8 6 7.57

Slide 55

Slide 55 text

• Generates 3D model data of "solid of revolution" • The shape is configurable by the DSL “Most three-dimentional” tompng4.rb - Spoiler $ ruby tompng4.rb > wine_glass.stl gen3d 'ochoko.stl' do l------------------------l l-ww------------------ww-l l-ww------------------ww-l l-ww++++++++++++++++++ww-l l-ww++++++++++++++++++ww-l l--ww++++++++++++++++ww--l l---wwww++++++++++wwww---l l----wwwwwwwwwwwwwwww----l l----www----------www----l end

Slide 56

Slide 56 text

• Tompng's comment “Most three-dimentional” tompng4.rb

Slide 57

Slide 57 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Best one-liner” 『最高のワンライナーで賞』 Colin Fulton (US) 6 9 8 6 7 7 10 7.57

Slide 58

Slide 58 text

“Best one-liner” justcolin2.rb • One-liner $🚀=0;def 🤔 🏷,🤔=0,&b;puts ' '*$🚀+( 🤔 ?"":"🚫 ")+🏷;$🚀+=4;b&.[];$🚀-=4;end

Slide 59

Slide 59 text

“Best one-liner” justcolin2.rb - Spoiler • 68-character test framework require './justcolin2' 🤔 "Math" do 🤔 "Addition" do 🤔 "One plus one equals two.", 1+1 == 2 🤔 "One plus one equals eleven.", 1+1 == 11 end end $ ruby test.rb Math Addition One plus one equals two. 🚫 One plus one equals eleven.

Slide 60

Slide 60 text

“Best one-liner” justcolin2.rb • justcolin's comment

Slide 61

Slide 61 text

Top three awards

Slide 62

Slide 62 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Best png viewer” 『最高の png のビューアで賞』 Tomoya Ishida (Japan) 8 8 8 7 8 6 9 7.71

Slide 63

Slide 63 text

“Best tool to view png” tompng5.rb X=[];class String def-@;replace ?-+self end;def-a;X.reject!{|x|x. __id__==__id__};a.replace(self+?-+a) end end;at_exit{eval C=(Zlib .inflate Integer((X*?-).tr(?-,'').tr('q-z','0-9'),26).digits(256) .pack'C*')};def method_missing n;(X<

Slide 64

Slide 64 text

“Best tool to view png” tompng5.rb - Spoiler $ ruby tompng5.rb trick.png trick.png undef p;X=[];class String def-@;replace ?-+dup end;def-a;X.reject!{|x|x.__id__==__id__};a.replace(self+?-+a) end end;at_exit{eval C= (Zlib.inflate (X*?-).tr(?-,'').tr('q-z','0-9').to_i(26).digits(256).pack'C*')};def method_missing n;(X<

Slide 65

Slide 65 text

“Best tool to view png” tompng5.rb - Spoiler $ ruby tompng5.rb trick.png > t.rb $ ruby t.rb trick.png trick.png undef p;X=[];class String def-@;replace ?-+dup end;def-a;X.reject!{|x|x.__id__==__id__};a.replace(self+?-+a) end end;at_exit{eval C= (Zlib.inflate (X*?-).tr(?-,'').tr('q-z','0-9').to_i(26).digits(256).pack'C*')};def method_missing n;(X<

Slide 66

Slide 66 text

• tompng's comment “Best tool to view png” tompng5.rb

Slide 67

Slide 67 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Best Spiral” 『最高の螺旋で賞』 Yusuke Endoh (JP) 6 10 N/A 10 9 9 6 8.33

Slide 68

Slide 68 text

“Best spiral” mame2.rb '';eval(r=%q(->z{r="'';eval(r=¥ %q(#{r}))[%q`#{z}`]";i=-040;30. times{|n|(15+n%2*15-n/2).times{ r<["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!(/#{%@`]

Slide 69

Slide 69 text

“Best spiral” mame2.rb - Spoiler

Slide 70

Slide 70 text

• A Quine that prints itself in spiral manner – Uses an escape sequence to move the cursor • The output is rearranged, and contains many escape sequences, but it is actually executable • mame's comment “Best spiral” mame2.rb - Spoiler

Slide 71

Slide 71 text

• The first letter of each line spells out: “Best spiral” mame2.rb - Spoiler '';eval(r=%q(->z{r="'';eval(r=¥ %q(#{r}))[%q`#{z}`]";i=-040;30. times{|n|(15+n%2*15-n/2).times{ r<["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!(/#{%@`] '';eval(r=%q(->z{r="'';eval(r=¥ %q(#{r}))[%q`#{z}`]";i=-040;30. times{|n|(15+n%2*15-n/2).times{ r<["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!(/#{%@`]

Slide 72

Slide 72 text

Winner » eban eto mame shinh yhara leonid matz AVG. “Most reserved” 『最も予約されていたで賞』 kinaba (JP) 7 7 10 10 10 10 7 8.71

Slide 73

Slide 73 text

• Before showing the program… – kinaba2.rb is a program that does nothing “Most reserved” kinaba2.rb

Slide 74

Slide 74 text

“Most reserved” FYI: Ruby's reserved words Ruby Reference Manual: spec/flexical https://docs.ruby-lang.org/ja/latest/doc/spec=2flexical.html Here is the list of the reserved words Reserved words

Slide 75

Slide 75 text

• A program that consists only of reserved words of Ruby “Most reserved” kinaba2.rb alias BEGIN for unless def class super true or return defined? next break while begin undef do end rescue then retry else undef module nil ensure case if yield __LINE__ self and redo elsif not __FILE__ alias END in end when __ENCODING__ end until false end

Slide 76

Slide 76 text

• A position of the reserved words has a strong restriction – must be inside rescue – / / must be inside loop – if return then true end #=> SyntaxError (void value expression) • Further restriction of "six words pre one line" is imposed “Most reserved” kinaba2.rb - Spoiler retry rescue break next redo if return then true end #=> SyntaxError (void value expression)

Slide 77

Slide 77 text

• / / can take reserved words • / can be used to avoid "void value expression" “Most reserved” kinaba2.rb - Spoiler def alias undef if return then true end #=> SyntaxError (void value expression) if false or return then true end #=> no error alias BEGIN XXX… or and

Slide 78

Slide 78 text

• kinaba's last comment “Most reserved” kinaba2.rb - Spoiler

Slide 79

Slide 79 text

Conclusion

Slide 80

Slide 80 text

Honorable mentions • Best monkey - Tomoya Ishida (tompng) • Best abuse of lambda - Shinichiro Hamaji • Best abuse of meta - Yuki Yugui Sonoda • Most solvable - Don Yang • Best layout - Yutaka HARA • Best abuse of regexp - Benoit Daloze (eregon) • Most tolerant - Shuichi Tamayose • Best applause - Colin Fulton – Enjoy them yourself at the github

Slide 81

Slide 81 text

Winners & Judges’ awards 6th & eban award: “Most reversible”–Yusuke Endoh 7th: “Best compiler”–Tomoya Ishida 8th & shinh & leonid awrad: “Most composable” – Colin Fulton 9th: “Most (un)readable” – Yutaka HARA 10th & matz award: “Best double meaning” – Tomoya Ishida 11th & eto award: “Most attractive” – Tomoya Ishida 12th & mame award: “Minimum alternative of irb” - Jan Lelis 13th & yhara award: “Most warned” – kinaba

Slide 82

Slide 82 text

Dishonorable Top Five “Most reserved” – kinaba “Best spiral” – Yusuke Endoh “Best png viewer” – Tomoya Ishida (tompng) “Best one-liner” – Colin Fulton “Most three-dimentional” – Tomoya Ishida 4th 5th

Slide 83

Slide 83 text

Prize? • Dishonor: the title of “insane” • Invitation to RubyKaigi 2018 • Top five entries will be checked into the Ruby official repository in “sample” directory – Ruby 2.6.0 will have them (perhaps)

Slide 84

Slide 84 text

General comments • Judges & winners, say your comments if any

Slide 85

Slide 85 text

Conclusion • The winning entries will be published soon at: • Thank you for all participants! • See you in the next TRICK "Returns" ??? No k! http://github.com/tric /trick2018/