Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Try Quine with Ruby - Quine

Try Quine with Ruby - Quine

tecot LT 2013/06/21

Takayuki Matsubara

June 21, 2013
Tweet

More Decks by Takayuki Matsubara

Other Decks in Programming

Transcript

  1. eval$s=%w'c=2;b="BAhsKzX/////////////////////A8D/////////////z8/zPwAA//8Pw88//z8 DwD/w/z//P///P/D/D/8///8Pw//D/wP//8PPw/AP8P//8P8P/P////////////////////8=";n=Mar sh al.load(b.unpack("m")[0]);r="";n.to_s(2).reverse.unpack( "a64"* 12).each{|l|r<<l<<10};x="BAhsKxH//// /P/w// D/8P /w//P//P/w //P///

    /8=";l =Marshal.load(x.unpa ck ("m")[ 0]);t="" ;l.to_ s(2).r everse.unpack( "a 16"*12). each{|l|t<<l<<10}; y="";c .times {r.lines.zip(t .lines){|a|y<<a[0].cho mp+a[1]};r=y;y=" ";};c> 2?c=1: c+=1;$s[2]=c.t o_s;w=r.lines.first. ch omp.length;n =r.gsub(10.chr,"") .reverse.t o_i(2);e="eval$s=% w"<<39 <<($ s* 3);o="";j= -1;(w* 12). times{|i|o<<((n[i]== 1)?e[j+=1]:32);o <<((i%w==(w- 1))?10 :"");};o[-7,6]=""<<39<<".join";puts(o)#c=2;b="BAhsKzX/////////////////////A8D/// //////////z8/zPwAA//8Pw88//z8DwD/w/z//P///P/D/D/8///8Pw//D/wP//8PPw/AP8P//'.join IUUQTHJTUHJUIVCDPNNBHFEFW
  2. ࢀߟ w 3VCZΛ༻͍ͨ௒ઈٕ޼ϓϩάϥϛϯάʢՆͷϓϩάϥϛϯάγ ϯϙδ΢Ϝʣ w IUUQXXXTMJEFTIBSFOFUNBNFUUFSSVCZ w 3FBEJOH4FMGEFTDSJQUJWF'J[[#V[[ w IUUQXXXTMJEFTIBSFOFUDIJBTUPMJUFSFBEJOHTFMGEFTDSJQUJWFp[[CV[[

    w 3VCZͰ͏ͲΜ͛2VJOF ͱ""ܕ2VJOFͷ࡞Γํߨ࠲ ͵͍͙ ΔΈϥΠϑ Ծ w IUUQEIBUFOBOFKQNJDLFZSVCZ@VEPOHF@RVJOF w 3VCZ)JSPCBͷ೉໰Λ2VJOFͰղ͘ w IUUQNBHFIFSPLVBQQDPNCMPHSBNFOCVSHFSJOSVCZIJSPCB