SlideShare ist ein Scribd-Unternehmen logo
1 von 33
超絶技巧  Ruby Programming Esoteric, Obfuscated Ruby Programming 遠藤侑介 Yusuke Endoh
Who am I? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Esoteric Programming ,[object Object],[object Object],[object Object],alias|send;$stdin=GC | &quot;%p?&quot;%def# FALSE.gets();(8  |  64).chr+232424. to_s(25)+&quot;, &quot;+%w|w !  |  *&quot;orlc&quot;. next<<012|| (c).Yusuke end;&quot;oh, 2009&quot;  |  &quot;stegano-X.&quot;[0,4].reverse d,be=&quot;whydoes&quot;,&quot;crypto&quot;;:make.  |  %.mains..tr'eams',be.delete(d) puts “Hello, world!” #!../s/grb -eh http:// d.hatena.ne.jp/kurimura/20090929/1254257912
Esoteric Programming Language (esolang) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],+++++++++[>++++++++>++++++++++ +>+++++<<<]>.>++.+++++++..+++. >-.------------.<++++++++.---- ----.+++.------.--------.>+. Hello world in brainf**k
Theme: Enjoy esolang with Ruby! ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1. Hello world with __ Character-only
Hello world with Number only ,[object Object],require &quot;1234567890&quot; 3168058133690614704472525542553548167675787479850929569348012322294505786632921189012284531906696218369564670777459615871118090530
実装  internal ,[object Object],[object Object],[object Object],Hello world with number only
ゲーデル数による符号化  Gödel numbering Hello world with number only
黒魔術  Ruby’s black magic ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Hello world with number only
Hello, world with underscore only require &quot;_&quot; ____ _ _____ ____ __ ____ ____ __ ___ ____ __ __ _ ______ _____ ___ _ _ ___ _____ ______ ____ _ _ ____ _ _ ____ _ ____ __ __ ___ _ ______ ___ ____ __ ______ ____ _ ____ ____ __ _ ____ _ _ ___ _____ _____ _ ______ ____ _ ______ _____
実装  internal ,[object Object],[object Object],[object Object],[object Object],Hello world with underscore only
なぜ  6  進数? why base-6? Hello world with underscore only
Hello world with  purely  Alphabet only ,[object Object],class  String def  inspect concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat  size concat  concat  size concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  concat  concat  size concat  concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  concat  size concat  concat  size concat  concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  size concat  concat  concat  concat  size concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  concat  size concat  concat  size concat  concat  size concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  size concat  concat  concat  size concat  concat  size concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  concat  size concat  concat  size concat  concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  concat  size concat  concat  size concat  concat  size concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  concat  size concat  concat  size concat  concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  concat  size concat  concat  size concat  concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  concat  concat  size concat  concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat  size concat  concat  concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat  size concat  concat  size concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  size concat  concat  concat  concat  size concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  size concat  concat  concat  size concat  concat  concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  size concat  concat  concat  size concat  concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  size concat  concat  size concat  concat  concat  concat  concat  size concat begin size ensure replace String nil end end eval  self exit  end  end copyright MMX Yusuke Endoh  p String nil class  String def  inspect concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat  size concat  concat  size concat  concat  size concat  size concat begin size ensure replace String nil end end concat  begin  dup  ensure  replace  String  nil concat  concat  concat  concat concat  concat  size concat  size concat begin size ensure replace String nil end end
実装  internal ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Hello world with purely alphabet only
対「文字制約」まとめ summary of anti-character constraints  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
2. Ruby for Quine in ASCII-art
Quine  とは  What’s Quine? ,[object Object],[object Object],[object Object],[object Object],[object Object],eval s=&quot;puts'eval s='+s.inspect&quot;
山手 Quine  Yamanote Quine ,[object Object],[object Object],[object Object],[object Object],z=27;eval$s=%w!c,s=[&quot;H+{K}8k->dXNpv-cD~@?(zhAi~>JOv<-;A(]oH+MFKs*+KOB825i$%QX9~P=HC{iIlj*Sh# v=3U62LhUXhtnCx^{F=nuTtGG}@85_(xVvIWQ|Vllp[Gt22x&`^K3*ui;IW@O9-(`Z6V_T.E]%WHXYGa{O9A#msMgV{5 R3XS/dxI8zM)XrbFom,$Msj8>=ca#i.yOqM-gtf2xH  T#2VYW9Koq.)IjS:&n3f6$Q/@4-8m_[(HxaP>n*b]Ih/3`3T uG-C~3Bn)d.PSdX8  uvtft?;j%bsM^v&h  NcaFzv7)uyD=lkc+eYn5&dN/%.|o@pD|BPi+a`rJCgg>?AE; W~){4l9}&quot;,&quot;_m?PM(N5L  <',.ht}f8B|*o8|Qg?:v  '(@LY'1^KvIm8twKZHvU@:&FS)r[N1?t9k26*=tiLQw<Tq$l ]V1@Z3hnQ:cQ'b)>])-p  }r'U[8hN  7`j6SW  r-ZW  m2  3n<ZaJ  %C%g  @@+DABEERjKj5Yt~&>xL ~8BN`L#u?tE+CH$wM%*J  px[D;A  t%se'c  waI.  R;  FIn(  VUVq{0  6c  Y]'1EV  sqNd_V1yp8&quot;].map{| s|n=0;s.unpack(&quot;C*&quot;)  .map{|  c|n=n*  91+(  c-1)%9  2};n};  e=  &quot;z=#{z  =($*[i=0]?(z+1):z- 1)%29};eval$s=%w&quot;<<3  3<<$s[  0,903]  *3;1  4.  time  s{|y|b  =&quot;  &quot;;n=f=  proc{|w|b<<e[i,w]; i+=w};t=s;f[4];z.dow  nto(0){|  a|a<1&  &6.t  imes  {|x|  y>1&&y<12&&c[n*60+y* 6-x-67]>0?(b<<32<<32):f[2]}while(0<n=(t/=38)%38)};f[4];y>12&  &b[-28,28]=&quot;&quot;<<33<<&quot;*''#..(c). Yusuke.Endoh.2010&quot;;puts(b)}#c,s=[&quot;H+{K}8k->dXNpv-cD~@?  (zhAi~>JOv<-;A(]oH+MFKs*+KOB825i $%QX9~P=HC{iIlj*Sh#v=3U62LhUXhtnCx^{F=nuTtGG}@85_(xVvIWQ|Vllp[Gt22x&`^K3*ui;IW@O9-(`Z6V_T.E] %WHXYGa{O9A#msMgV{5R3XS/dxI8zM)XrbFom,$Msj8>=ca#i.yOqM-gtf2xHT#2!*''#..(c).Yusuke.Endoh.2010 t=&quot;+,m-n./mAm0o1p23a4q56r7sBt89u-t-1:v;A<w4x=y1z>[?]A^@CD_ CD_EsF`GHmIJbKa*l&quot;;eval$s=%w{F=%q{ceY8#<DvO1=x&t9CSOqMYkzH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-K]+.)([*-K]+.)$/];t=$2+$`+s =$1):(s=t[/.+?[L-z]/];t=$'+s  );f=Zlib::Inflate.inflate(Ma rshal.dump(f)[7..-1]  );S=%{  t=&quot;#  {t}&quot;;eval$s=%w{#$s}* &quot;&quot;;%|}+F*9;P=proc{pu  ts(S.s  lice!(0,  58));P};P[][][][s. upcase.unpack(&quot;C*&quot;  ).map{|c  |c-=c>92?4  3:42;;P[][][20.t imes{|n|puts((&quot;%  029b&quot;%(&quot;  &quot;+f[60*c+3*n  ,3]).unpack(&quot;N &quot;)[0]).gsub(  /./){$&<&quot;1&quot;?  (S.slice!(0,2)  ):(32.chr*2) })}]}][];puts(*[&quot;+&quot;+&quot;-&quot;*  25,&quot;|,##,(c),Yusuke,Endoh,20 09&quot;.split(&quot;,&quot;).join(32.chr)].map{|l|S.slice!(0,32)+l})}*&quot;&quot; ;%|ceY8#<DvO1=x&t9CSOqMYkzHU.kCpz+Vo8hB.1AF&tq21+$/IrMY]U. aDd!-1y!4MMGQm6m?bYh($QMYpXs4g,x1UlbNKH?>NzbisMn?sT@m3,F.A bb`xW!r%'%Ybee>xkUfjf[(*^NdXo_&quot;@+------------------------- hQh%Fx*q[iB7EM&quot;suSG8GVOIzceg/O=4| ## (c) Yusuke Endoh 2009
実装  internal ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Yamanote Quine z=27;eval$s=%w!c,s=[ &quot;H+{K}8k->dXNpv-cD~@?(zhAi~>JOv<-;A(]oH+MFKs*+KOB825i$%QX9~P=HC{iIlj*Sh# v=3U62LhUXhtnCx^{F=nuTtGG}@85_(xVvIWQ|Vllp[Gt22x&`^K3*ui;IW@O9-(`Z6V_T.E]%WHXYGa{O9A#msMgV{5 R3XS/dxI8zM)XrbFom,$Msj8>=ca#i.yOqM-gtf2xH  T#2VYW9Koq.)IjS:&n3f6$Q/@4-8m_[(HxaP>n*b]Ih/3`3T uG-C~3Bn)d.PSdX8  uvtft?;j%bsM^v&h  NcaFzv7)uyD=lkc+eYn5&dN/%.|o@pD|BPi+a`rJCgg>?AE; W~){4l9}&quot; , &quot;_m?PM(N5L  <',.ht}f8B|*o8|Qg?:v  '(@LY'1^KvIm8twKZHvU@:&FS)r[N1?t9k26*=tiLQw<Tq$l ]V1@Z3hnQ:cQ'b)>])-p  }r'U[8hN  7`j6SW  r-ZW  m2  3n<ZaJ  %C%g  @@+DABEERjKj5Yt~&>xL ~8BN`L#u?tE+CH$wM%*J  px[D;A  t%se'c  waI.  R;  FIn(  VUVq{0  6c  Y]'1EV  sqNd_V1yp8&quot; ]. map{| s|n=0;s.unpack(&quot;C*&quot;)  .map{|  c|n=n*  91+(  c-1)%9  2};n};   e=  &quot;z=#{z  =($*[i=0]?(z+1):z- 1)%29};eval$s=%w&quot;<<3  3<<$s[  0,903]  *3; 1  4.  time  s{|y|b  =&quot;  &quot;;n=f=  proc{|w|b<<e[i,w]; i+=w};t=s;f[4];z.dow  nto(0){|  a|a<1&  &6.t  imes  {|x|  y>1&&y<12&&c[n*60+y* 6-x-67]>0?(b<<32<<32):f[2]}while(0<n=(t/=38)%38)};f[4];y>12&  &b[-28,28]=&quot;&quot;<<33 <<&quot;*''#..(c). Yusuke.Endoh.2010&quot;;puts(b)}#c,s=[&quot;H+{K}8k->dXNpv-cD~@?  (zhAi~>JOv<-;A(]oH+MFKs*+KOB825i $%QX9~P=HC{iIlj*Sh#v=3U62LhUXhtnCx^{F=nuTtGG}@85_(xVvIWQ|Vllp[Gt22x&`^K3*ui;IW@O9-(`Z6V_T.E] %WHXYGa{O9A#msMgV{5R3XS/dxI8zM)XrbFom,$Msj8>=ca#i.yOqM-gtf2xHT#2 !*''#..(c).Yusuke.Endoh
アスキーアートでプログラムを書く How to write “shaped” Ruby program ,[object Object],[object Object],[object Object],[object Object],[object Object],Yamanote Quine eval %w( pu ts “ H i” ).join## eval %w(( ).join %w(foo bar) [“foo”, “bar”]
圧縮  compression ,[object Object],[object Object],[object Object],[object Object],Yamanote Quine デコーダ小  shorter decoder データ大  longer data データ小  shorter data デコーダ大  longer decoder data size (about) decoder ~  10 bytes No compression ~  100 bytes String#to_i(36)  ~  500 bytes Base64  More Zlib + pack
15quzzle ,[object Object],eval$s=%w[b=0 x40e1359a76cb d8f2;i=(m=0.. 15).find{|i|1 >b&m=15<<4*i} ;t=m|n=m<<4*o =(&quot;AdABrBlBAu A&quot;=~/(.)#{ARG V*''}/||04| |0)-4;(n<1||n >1<<64||[255< <12]&[t>>040| |___________2 |__________15 |___________8 |__________13 |0,t>>16,t]!= [])?t=0:i+=o; ;s=&quot;eval$s=%% w[b=0x%016x&quot;% (b^=t.&b|m&b> >o*4)+$s.gsub (/(_++)+/ ,'')[/;.*/]+&quot; ]*''||0&quot;<<92| |1;z=s=s.scan (/.{13}/);3.t imes{|j|s[(i| |__________11 |__________12 |___________6 |___________7 |0)/4*8+i+j*4 ,0]=m=(z=32.c hr)*13};c=b;4 .times{puts(( 0..3.times{pu ts((s.slice!( 0,4)*z).rstri p)}).map{j=c% 16;c/=16;;(0| |0)<(j)?&quot;|&quot;+j .to_s.rjust(1 2,&quot;_&quot;):m}*(z| |__________10 |___________9 |___________5 |___________3 |0),z)};b==0x fedcba9876543  21&&(&quot;%b&quot;%&quot;1t v7c1th0wylel7 3ba35knw3t&quot;.t  o_i(36)).tr(&quot; 01&quot;,&quot;.#&quot;).sca n(/.{25}/){pu  ts$&}]*''||0|___________1 |__________14  |___________4
tic-tac-toe (○× ゲーム) ,[object Object],[object Object],s=&quot;n='  '[0,2] ######  d|=1<<  ##  ##  $*[0]. ##  ##  to_i-1  ##  ##  ;m,i=[ ##  ##  f=proc  ##  {|b|a= ##  ##  [];[73  ##  ##  ,7,84, ######  273,56  ##  ##  ,146,&quot; proc{|  t|[t*= &quot;&quot;,s].map{|u|u.gsub!(35.chr,&quot;&quot;)};d=0032205;eval(s+t)}[ %w(448,292].find{|m|b&m==m}?1:9.times{|i|b&(513<<i)<1& &a<<[-f[1<<i|b>>9|b<<9][0],i]}&&a.min||0}][0][d];s='s= &quot;'+s.s  plit*' ##  ##  '+'&quot;pr  ##  ##  oc{|t|  ###### ##  ##  [t*=&quot;&quot;  ##  ##  ,s].ma  ##  ## ##  p{|u|u  ##  .gsub!  ##  ## ##  ##  (35.ch  ##  ##  r,&quot;&quot;)}  ##  ## ##  ##  ;d=0%0  ##  ##  6o;eva  ###### l(s+t)  }[%%w( '%d|=512<<i;s<<t+&quot;)]&quot;;27.times{|y|i=y/10;y%=10;puts(y> 6?s.slice!(0,54):(0..4).map{|x|x&1>0?(i+=3;s.slice!(0, 6)):62[y]<1?n*7:n+(y*5-5...y*5).map{|j|1105[j-7]<1&&d[ i]|d[i  +9]>0& ######  &~j&59  81[j/2 ##  ##  ]^d[i]  >0?35. ##  ##  chr*2:  n;}*&quot;&quot; ##  ##  +n}*&quot;&quot;  )}||__ ######  (c).Y.  Endoh. _2009_  ____)]
Quine Reversi ,[object Object],[object Object],1;BEGIN{eval$t=%q(eval(%w(d=&quot;(a,b=b,a;#{c=&quot;(r=l='' ;6  4.  ti  me  s{  |n  |p  =2  << n+  n/  8;  v=  '.  .8  6.  41  7. 5.9...32'[((n%8*2-7).*n/8*2-7).abs%19,1];#{o=&quot;m=0; (a  |b  )&  p>  0|  |9  .t  im  es {|  s|  e,  q=  0,  p;  (e  |=  q) while(q<<=s*9%26-10)&b>0;a&q>0&&m|=e};&quot;}l>v||m>0&& (l  <v  &&  (l  ,r  =v  ,[  ])  ;r <<  p)  };  p=  r[  00  00  00  00 0000])&&(&quot;}#{w=o+&quot;b^=m;a^=m|p)&quot;};a,b=b,a;p)&quot;;z=32. ch  r;  c+  =&quot; () |'  'u  nt  il  ($ ><  <'  ?'  +( () |' /';  z)  ;g  et s)=~/^[A-H][1-8]$/&&(p=1<<$&.tr('A-H','0-7').to_i( 9)  ;#  {o  }'  '; () ;m  >0  );  &quot;+ w;  b,  a=  (' /'; () ;2  57  )<  <3 2,1025<<31;puts&quot;<<Reversi>>&quot;;loop{i=f=g=0;puts(*(&quot; A&quot;  ..  &quot;H  &quot;)  .m  ap  {|  x|  9. ti  me  s{  x+  =&quot;  :&quot;  <<  32  +a [i+=1]*47+b[i]*56};x}<<[z,*1..8]*z);eval(c+&quot;&&(c,d =d  ,c  )|  |&quot;  +d  )|  |(  72  .t im  es  {f  +=  a&  1;  a/  =2  ;g +=b&1;b/=2};puts&quot;O:#{f},X:#{g}&quot;,f<g&&&quot;youmdon'tmde se  rv  em  qu  in  e&quot;  .t  r(  &quot;m &quot;,  z)  ||  &quot;R  ev  er  si    1; BEGIN{eval$t=%q(#$t)}&quot;;exit)}#(c)Y.Endoh'10)*''))}
Merry Quine-mas ,[object Object],[object Object],open(&quot;/dev/dsp&quot;,&quot;wb&quot;){|h|s=%q{d=[&quot;-KQW[UZbgu*HNT+]TNOOOTZ+cZTUUUUUZbagmssUZbagm ss+wmpgja+KQW[dfnu&quot;,&quot;-KEKOINV[W*HBH+QHBCCCHN+WNHIIIIINVU[aUUINVU[aUU+YOR[^I+KEK OXZbW&quot;,&quot;-W[acg vsc*TZ`+eaaaaa--vucavuca+eadsvs+W[dgvrtc&quot;,&quot;-K991LIL77777dIIIII-- LKKILKKI+Mad[  ^U+K991LHJK&quot;].map{|l|l.unpack(&quot;C*&quot;).map{|c|[(c/6-4)*12/7-8,&quot;012 35b&quot;[c%6,1].  hex]}*4};y=32.chr;l=&quot;@&quot;+[(m=&quot;Jnx4sn3sgd1&quot;)+&quot;vnqkc!6sgd2Lnqc4gz r4bnld;6/Ld  s2dzqsg6qd2@bdhud6gdq2Khmf;77/Lds2du4@dqx4gdzqs6oqd2@ozqd4ghl 4qnnl,+Amc  2gdz++2  @udm  4z  mc  2gdz  4@+u  dm  2zm c2mz+@stqd+r  hmf&quot;,m+&quot;E  zq  sg  !6sgd2Sz  u4@h  nt  q4qd  hfm  r;  6/Ld s2ldm6sgdhq  2rnmfr6d  l  2  @o  knx  ;77/  Wghkd2  ehdkc r4zmc4eknn  cr,6qnb  jr  ,2  gh  kkr,4zmc  4okz  hm  r+Rd  2@odz  s+2+,6 qd2@odzs6  +sgd2r  ntmc+@  hm  f+  inx&quot;  ,&quot;  Nn4l  nqd3k  ds1rhm r6zmc2rn  4@qqnvr4fqnv,6/Nnq2sgnqmr6hm2@edrs6sgd2fqntmc;77/Hd2bnldr4 sn4lzjd  6Hhr2ak  d4@rrh  mfr4eknv+Fzq2zr+2+,6ezq2zr,6+sgd2btqr d+hr+entmc  &quot;,&quot;Hd4qtkdr3s  gd1  vnqkc6vhsg2sqtsg4zmc4fqzbd,6/Amc2lzjdr6 sgd2mz6@s  hnmr2oqnud77/ T  gd2fk  n4@q  hdr4  ne6Hh  r2qhfg s4@dntr4  @mdrr,+Amc2v  nm+2+6@  cd  qr,  2v  nm6  +@cdqr2ne+Hh r+knud&quot;  ].map{|a|  a ,b,c,e,  *  f  =a.  sp  lit&quot;  +&quot;;[a,c =b+c+f  *&quot;2&quot;,c  ,b+  e+f*&quot;4  &quot;+  &quot;.  8/  /&quot;]*&quot;6/&quot;  }.join .tr(&quot;  a-z  /&quot;,&quot;b-  za n&quot;).gs  ub  (/^/  ,&quot;  #&quot;<<32) ;c=0;640.tim  es{|w|c<1&&(l=~/(@)?(.*?)()/m;($>.<<$1?$2:y+$2).flush;l=$';c =eval$3);c-=  1;a=[128]*z=1200;4.times{|j|t,n=d[j].pop;f=0.3456*2**(t/12.0-j /2);(n>0?(d[  j]<<[t,n-1];z):800).times{|i|t>-3&&a[i]+=16*Math.sin(f.*w*z+i) }};(h.<<a.pack&quot;C*&quot;).flush};puts(s.gsub(/./){&quot;!&quot;>$&?&quot;#&quot;:y}+%(open(&quot;/dev/dsp#{&quot; (c)Y.Endoh2009&quot;;'&quot;,'}&quot;wb&quot;){|h|s=%q{#{s}};eval(s.split*&quot;&quot;)}))};eval(s.split*&quot;&quot;)}
qng  と  qif ,[object Object],png gif
Quine relay ,[object Object],[object Object]
Quine relay ,[object Object],[object Object]
対「文字配置制約」まとめ summary of anti-shape constraints  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
結論  conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
最後に  aside ,[object Object],[object Object],[object Object]
実行に  5  分かかる  Quine Quine that takes five minutes 0;BEGIN{eval((q=%q!;;;;;;;;;;m=0;&quot;t%t{{ix~z~oQec6wJJ:}8:='uaZNui3iT.*zTPZAg|ehncOt_R+PZygXY^pQr(8|ad1=WL P&m|:,~'hhy>c%9]c+c^3q3za?Mav:@;&<uIcrU,(qK6*y/SabA}(ELSn^VDTtX0y,#]-,lX#o3xEM0zNu#,EOH]ztbB]Ej5g:*S1:;6 hJH7G=OoZts_Vg'G/E1[;CF^G$N/lzn.|`LTCh{>{U34gHz~ZbPt,8w?'yJ?Szux+6(V1=kvbQkU&<zs`4*:L)S`|t:Rt_yW16^pY95u b2[W9blchB)023X81n7JhmD?~l#GrjF:}WI^,T13SbN;^X2WOayWs~,)j>=Um.|-{d'l0z<Z[WXD`K,xV{pL{4hJao4z(:P8;<x**2#6 mL4`+[aYYzR[&vx*JEU67hE>;dKzSPC9n]T,Lu>CtxZ{tSuuEKDS}^7mh3LZV:P+Zf-csJ-=`+^d:rK|Dj,bG-4Qn2o?Ef9mXkH`YAKA EJ[A:s#WaEcM.&DEwG#XhM3R*1i-l-cl-3<){DME(cq1GNwMcc2BKqHT)=<y8WV*(K_pGLE^?4NDbaV+8B'Xuh`ZzduwqT_rFwjFj)M) WgYs8S'*9c+&3~AC7K2f0&7YOMA[_:l[1uDq?'I5'KiWG+&YKlQ;}1)zBdFVy~3Uu[hNvw}NxT^HY1i?`&tP'r(W(n=dJ_AfU_{{1iS~ <LzKnkZ1ZSB&;;N*$VcL].'D6(s::-|pXSW<GGNXtpY+,b  R-MYxp^#y@lBfG)9MDEr,L509}OZWy8fXH~bX1HzM'N}J] L)N:5(2NWq`2VH#nUm]^H9]_P;`]IJHk*i^j:rf4E  1#yA}0<U-O,PISL8<^?sPJvf.sIA`#Coq,P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EOo c?X66q^MP+a_QF[  5n^dco  %tQ[LH  ^TR~9*yVtPB$W  Bo,) C1D  1R/}D`  /(kn$#0-i/Pk]u ACqIo.j'y`L.X'  fHlU,  j=t8/)  I|xiqhB>=te  y22sJ~Q  zlaYK`J<U8uGK jRpO9)0#V~pv6  x{),{  2Z|UAX5  P]tXO{  ;w'E1  P  #`U( Dqi>  &;^=4PDCVQ4^0 ,_4Tiqx(]~nef  7d2m'  M+_e^l  ,`gsM  )aTH  $Zg{c9uQ<+Rc3 2X4ChjpzkE+Z-  :cY9V  B@S46)  jA7|S(CR}REd bB5sX:pL3dodV  W_bFEhR<94w  K*,D@$3G1<  @mA9  4#&6s7&.1l]  #=8Q  4kxPFMgc-2q+ <y:OWs_?keS)  (wOjXU@{SV  QvxR<u8Yc%T  uG4T  NDAiLmq-^ily  U*c-  K)M:8ASo9Fwx ev)DkF]t)P}0  OmZ]9/#/>HO  k  #wlr,  A+Fc jGh2_  53|o{  lzGS  .S/48<%.kMMu 5[rl98M[dF6c  *ubR~JkG^,ii  1miOE&QUxV  k*Zv 8B0>+  roF8  2bnI  M`9%ZQCa66)^ q_DBDTh_R$<y  <[)e_  li,i^f  NM<c<1PS(;Zp Zx6LV fK%yN  opqc  `y?+  tGKuv[Poogc? )n#47L4N$r+2  {.PA,  MItVs D{N_(  (ecZ w1A94 ~v1&5  |%39$G  #m3=  ];%A>*9s4S@K 0JG<4#W+X:5LM  sb*O%  ftVzGo b;v5-Hw'pbBM {$8lK  5M'JE>9(.T<l  9`_y  otmN/mngZT_; WC~VO?8.bybN;  `wo/E  i+cbk`,*,#VFac~ti( D-CBu  Gry1uXUSgiH  f/WZ  4b-qMEBGlr~X [-]TG6[AcPM^#  CUD  xKyu  O2Z  i]O  )|  w$KM  U'  dpcFq-~5:fPmg R5k.&hM-bih8|  )9L{YN  {3:5y  #tbyW}n+'c;9%ni-0H~  _?wXw|@mx,<(@ ngEX<r]aln'J0,  bp7r[U@`0&  f88<vpafh  RQ{B86E%NET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zIJ?xGh0x{tGsbpj+&q$q;JTl~t+5D  d>oo{^.ni8?a{M&_,v9(HSL@'BKVvCn{W% W^Eb+j`*fwEAX.RQQ4YGGnrER0ue&q-1`1*|,v(  n(E_iZ0+]&*bP9_:$C5,U(Ok>q:v'A_iXMBEKn PN_@&_anx>7HUZd&s_obY?GJdr$UHZYoawgVCX_xE4%=*{  o8x6w(MqKD4%?lKn>$E$UzvD]2OH3*^Bx4|Ah9Ti&umkzq %Rf0~f&^F,R=ExlM;$zp1&a45BU)S^;M:F{&pgixwE:~Rf3uV]#efJ](ez%)6Up;wb0jql2vto'WrN0G08]n1)aR6n6z`0XgUc3c13Ct Q[h^k-yB&H3.^2Xy@3j1yxFy7_@0Zp5;?WO<QAFa2?H)WECpEG0ysq$57Yq{g)F.L@H1EPf2M`R<Xls&quot;.unpack(&quot;C*&quot;).map{|c|m=m *91+(c-1)%92};require&quot;tempfile&quot;;c=Tempfile.new(&quot;rk&quot;);c.close(0>0);n=c.path;IO.popen(&quot;gcc#{z=32.chr}-o#{n +z}-xc#{z}-&quot;,&quot;w&quot;){|h|h<<(&quot;#include<stdio.h>&quot;<<10<<&quot;#include<sys/soundcard.h>&quot;<<10<<'int'<<z<<'main(void) {printf(&quot;%lx&quot;,SOUND_PCM_WRITE_RATE);return'<<z<<'0;}')};n=`#{n}`;c.unlink;require&quot;zlib&quot;;a,r,b,c=Marshal. load(Zlib::Inflate.inflate([m.to_s(16)].pack(&quot;H*&quot;).reverse));eval(c)!).split*'')};(c).Yusuke Endoh, 2010

Weitere ähnliche Inhalte

Mehr von mametter

error_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnosticserror_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnosticsmametter
 
TRICK 2022 Results
TRICK 2022 ResultsTRICK 2022 Results
TRICK 2022 Resultsmametter
 
クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料
クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料
クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料mametter
 
Enjoy Ruby Programming in IDE and TypeProf
Enjoy Ruby Programming in IDE and TypeProfEnjoy Ruby Programming in IDE and TypeProf
Enjoy Ruby Programming in IDE and TypeProfmametter
 
TypeProf for IDE: Enrich Development Experience without Annotations
TypeProf for IDE: Enrich Development Experience without AnnotationsTypeProf for IDE: Enrich Development Experience without Annotations
TypeProf for IDE: Enrich Development Experience without Annotationsmametter
 
Ruby 3の型解析に向けた計画
Ruby 3の型解析に向けた計画Ruby 3の型解析に向けた計画
Ruby 3の型解析に向けた計画mametter
 
emruby: ブラウザで動くRuby
emruby: ブラウザで動くRubyemruby: ブラウザで動くRuby
emruby: ブラウザで動くRubymametter
 
Type Profiler: Ambitious Type Inference for Ruby 3
Type Profiler: Ambitious Type Inference for Ruby 3Type Profiler: Ambitious Type Inference for Ruby 3
Type Profiler: Ambitious Type Inference for Ruby 3mametter
 
型プロファイラ:抽象解釈に基づくRuby 3の静的解析
型プロファイラ:抽象解釈に基づくRuby 3の静的解析型プロファイラ:抽象解釈に基づくRuby 3の静的解析
型プロファイラ:抽象解釈に基づくRuby 3の静的解析mametter
 
Ruby 3の型推論やってます
Ruby 3の型推論やってますRuby 3の型推論やってます
Ruby 3の型推論やってますmametter
 
マニアックなRuby 2.7新機能紹介
マニアックなRuby 2.7新機能紹介マニアックなRuby 2.7新機能紹介
マニアックなRuby 2.7新機能紹介mametter
 
A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3mametter
 
A Plan towards Ruby 3 Types
A Plan towards Ruby 3 TypesA Plan towards Ruby 3 Types
A Plan towards Ruby 3 Typesmametter
 
Ruby 3 の型解析に向けた計画
Ruby 3 の型解析に向けた計画Ruby 3 の型解析に向けた計画
Ruby 3 の型解析に向けた計画mametter
 
A Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and UnderstandingA Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and Understandingmametter
 
本番環境で使える実行コード記録機能
本番環境で使える実行コード記録機能本番環境で使える実行コード記録機能
本番環境で使える実行コード記録機能mametter
 
Transcendental Programming in Ruby
Transcendental Programming in RubyTranscendental Programming in Ruby
Transcendental Programming in Rubymametter
 
Cookpad Hackarade #04: Create Your Own Interpreter
Cookpad Hackarade #04: Create Your Own InterpreterCookpad Hackarade #04: Create Your Own Interpreter
Cookpad Hackarade #04: Create Your Own Interpretermametter
 
Ruby 3のキーワード引数について考える
Ruby 3のキーワード引数について考えるRuby 3のキーワード引数について考える
Ruby 3のキーワード引数について考えるmametter
 
TRICK 2018 results
TRICK 2018 resultsTRICK 2018 results
TRICK 2018 resultsmametter
 

Mehr von mametter (20)

error_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnosticserror_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnostics
 
TRICK 2022 Results
TRICK 2022 ResultsTRICK 2022 Results
TRICK 2022 Results
 
クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料
クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料
クックパッド春の超絶技巧パンまつり 超絶技巧プログラミング編 資料
 
Enjoy Ruby Programming in IDE and TypeProf
Enjoy Ruby Programming in IDE and TypeProfEnjoy Ruby Programming in IDE and TypeProf
Enjoy Ruby Programming in IDE and TypeProf
 
TypeProf for IDE: Enrich Development Experience without Annotations
TypeProf for IDE: Enrich Development Experience without AnnotationsTypeProf for IDE: Enrich Development Experience without Annotations
TypeProf for IDE: Enrich Development Experience without Annotations
 
Ruby 3の型解析に向けた計画
Ruby 3の型解析に向けた計画Ruby 3の型解析に向けた計画
Ruby 3の型解析に向けた計画
 
emruby: ブラウザで動くRuby
emruby: ブラウザで動くRubyemruby: ブラウザで動くRuby
emruby: ブラウザで動くRuby
 
Type Profiler: Ambitious Type Inference for Ruby 3
Type Profiler: Ambitious Type Inference for Ruby 3Type Profiler: Ambitious Type Inference for Ruby 3
Type Profiler: Ambitious Type Inference for Ruby 3
 
型プロファイラ:抽象解釈に基づくRuby 3の静的解析
型プロファイラ:抽象解釈に基づくRuby 3の静的解析型プロファイラ:抽象解釈に基づくRuby 3の静的解析
型プロファイラ:抽象解釈に基づくRuby 3の静的解析
 
Ruby 3の型推論やってます
Ruby 3の型推論やってますRuby 3の型推論やってます
Ruby 3の型推論やってます
 
マニアックなRuby 2.7新機能紹介
マニアックなRuby 2.7新機能紹介マニアックなRuby 2.7新機能紹介
マニアックなRuby 2.7新機能紹介
 
A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3
 
A Plan towards Ruby 3 Types
A Plan towards Ruby 3 TypesA Plan towards Ruby 3 Types
A Plan towards Ruby 3 Types
 
Ruby 3 の型解析に向けた計画
Ruby 3 の型解析に向けた計画Ruby 3 の型解析に向けた計画
Ruby 3 の型解析に向けた計画
 
A Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and UnderstandingA Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and Understanding
 
本番環境で使える実行コード記録機能
本番環境で使える実行コード記録機能本番環境で使える実行コード記録機能
本番環境で使える実行コード記録機能
 
Transcendental Programming in Ruby
Transcendental Programming in RubyTranscendental Programming in Ruby
Transcendental Programming in Ruby
 
Cookpad Hackarade #04: Create Your Own Interpreter
Cookpad Hackarade #04: Create Your Own InterpreterCookpad Hackarade #04: Create Your Own Interpreter
Cookpad Hackarade #04: Create Your Own Interpreter
 
Ruby 3のキーワード引数について考える
Ruby 3のキーワード引数について考えるRuby 3のキーワード引数について考える
Ruby 3のキーワード引数について考える
 
TRICK 2018 results
TRICK 2018 resultsTRICK 2018 results
TRICK 2018 results
 

超絶技巧 Ruby プログラミング - Esoteric, Obfuscated Ruby Programming

  • 1. 超絶技巧 Ruby Programming Esoteric, Obfuscated Ruby Programming 遠藤侑介 Yusuke Endoh
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. 1. Hello world with __ Character-only
  • 7.
  • 8.
  • 9. ゲーデル数による符号化 Gödel numbering Hello world with number only
  • 10.
  • 11. Hello, world with underscore only require &quot;_&quot; ____ _ _____ ____ __ ____ ____ __ ___ ____ __ __ _ ______ _____ ___ _ _ ___ _____ ______ ____ _ _ ____ _ _ ____ _ ____ __ __ ___ _ ______ ___ ____ __ ______ ____ _ ____ ____ __ _ ____ _ _ ___ _____ _____ _ ______ ____ _ ______ _____
  • 12.
  • 13. なぜ 6 進数? why base-6? Hello world with underscore only
  • 14.
  • 15.
  • 16.
  • 17. 2. Ruby for Quine in ASCII-art
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. 実行に 5 分かかる Quine Quine that takes five minutes 0;BEGIN{eval((q=%q!;;;;;;;;;;m=0;&quot;t%t{{ix~z~oQec6wJJ:}8:='uaZNui3iT.*zTPZAg|ehncOt_R+PZygXY^pQr(8|ad1=WL P&m|:,~'hhy>c%9]c+c^3q3za?Mav:@;&<uIcrU,(qK6*y/SabA}(ELSn^VDTtX0y,#]-,lX#o3xEM0zNu#,EOH]ztbB]Ej5g:*S1:;6 hJH7G=OoZts_Vg'G/E1[;CF^G$N/lzn.|`LTCh{>{U34gHz~ZbPt,8w?'yJ?Szux+6(V1=kvbQkU&<zs`4*:L)S`|t:Rt_yW16^pY95u b2[W9blchB)023X81n7JhmD?~l#GrjF:}WI^,T13SbN;^X2WOayWs~,)j>=Um.|-{d'l0z<Z[WXD`K,xV{pL{4hJao4z(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z p7<-B YN23j} AdIb gSwpYxSv8>FiVg]zdKg|&R u[?Jx^}=zSt8O}p4ywRi>mFpBzVBDO&go[sr 4=^3gy]DQM3^ Dg8>g _f(~TKy[lX=1 }'?viwdOC4U:fmZ>kaFUkL&s =ciM;pm35Ydzkjtq[$jC9xBU<9@a2_S*J9,g Br'KQYRvcj 1w5Sw #e+v:6>Bv ,gNTR}u_/gi]82]dhVn8z5^1=0 ws2cCXeY.2?z>CHjSiK`A5}:^Pu=3 8 ${-QEtGk<?AQr(zYJOjRYu+@G&h2 i|25q'l8tz$d(bl8Jq=ix%UY{-OCrN{2 b/M'-:85oZLnwJ[iIRC(^Up~QMfMqU] ?iV%zIJ?xGh0x{tGsbpj+&q$q;JTl~t+5D d>oo{^.ni8?a{M&_,v9(HSL@'BKVvCn{W% W^Eb+j`*fwEAX.RQQ4YGGnrER0ue&q-1`1*|,v( n(E_iZ0+]&*bP9_:$C5,U(Ok>q:v'A_iXMBEKn PN_@&_anx>7HUZd&s_obY?GJdr$UHZYoawgVCX_xE4%=*{ o8x6w(MqKD4%?lKn>$E$UzvD]2OH3*^Bx4|Ah9Ti&umkzq %Rf0~f&^F,R=ExlM;$zp1&a45BU)S^;M:F{&pgixwE:~Rf3uV]#efJ](ez%)6Up;wb0jql2vto'WrN0G08]n1)aR6n6z`0XgUc3c13Ct Q[h^k-yB&H3.^2Xy@3j1yxFy7_@0Zp5;?WO<QAFa2?H)WECpEG0ysq$57Yq{g)F.L@H1EPf2M`R<Xls&quot;.unpack(&quot;C*&quot;).map{|c|m=m *91+(c-1)%92};require&quot;tempfile&quot;;c=Tempfile.new(&quot;rk&quot;);c.close(0>0);n=c.path;IO.popen(&quot;gcc#{z=32.chr}-o#{n +z}-xc#{z}-&quot;,&quot;w&quot;){|h|h<<(&quot;#include<stdio.h>&quot;<<10<<&quot;#include<sys/soundcard.h>&quot;<<10<<'int'<<z<<'main(void) {printf(&quot;%lx&quot;,SOUND_PCM_WRITE_RATE);return'<<z<<'0;}')};n=`#{n}`;c.unlink;require&quot;zlib&quot;;a,r,b,c=Marshal. load(Zlib::Inflate.inflate([m.to_s(16)].pack(&quot;H*&quot;).reverse));eval(c)!).split*'')};(c).Yusuke Endoh, 2010