Skip to content

ta-chibana/hey_quine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hey Quine

i=1;eval$s=%w(s=%(i=#{(i+1)%4};eval$s=%w(#{$s})*"";);F=["?t4e4nq5ZOO0qrwiS.;Bl:[
5AUZ`SXJ*L`SMpUJK2ZdOM*t*wZ9Ks+[qnbUtsuMn9`hbJ7JGz^3LAxnB3tVU~/,Dgvzy8/U}.;Ar2ml
;Hb[<RH1wtuGKDpVFP.c-30I>DnP80Dv3Q7ZTG4`YV5ox1=-~or;4*hz34v,`?]5S7-/3;7/a.derS2m
NNI,wIf7+M^pqZj5<,     /l<C~3r?wQHEyIhw4z<5gw=P=1,~l53^spgB:A^^`O5jHBPTRqt+Pp~AX
3~O8qyxX^yk*in0K       ;Lp|~`=fx..wCgSjHI/kF0f}d?v>7fwd424H*?CSOrU{ZU3mH@=Sw:zGB
CconXzC","?u<|8       Rk;_.195|*yDl@,NjL8Go89hT9OJDh;YtM=}]@8>hNp*yHP=,~BH]XS>oV
/<w9QKhZ2U}Qa9      x+yNA]{=JM>-or?bALEPEV8RT6L3Vbc,+azNq8q:q7~+PyXFWYj_yJ/Rv5dk
3q|?9*Lhc-d+0      6JpNmb/cOue^=6y{M2A]QdK<w?n[qGY*c[`z2P/h9NlGDb9?P9vdvYsKbru[i
J^^yx@?e~pl.      +F/6QP2M<Qy8a@}=a:Sid*zQ;xs>o@s0{W:U@<P5L6Zn+P2X*zMpOr03ym?V`@
WUlUgo:b9.k      QzNdqkEEMxSn29=qing>VC`A^SwYp-[F:Q.ptKFHC+","?u<|8Rk;_.1956nKJ_
jL41+oEchI      fpeDg7+Xb|f/44Hn-_jmT6e@Q]X4PW{F{E~8>@,Qco?ret3Ao+kf6={<}JckMd`^
XLSuj6cP@      :<+N;UR9z9YxE^k^d7,B<epB;JCw1S6_xb0GIRBp9[nSMLi*tU2=QD/xLe_DF4wKd
j>*4FOmV>     :2_z?m6xoNY-wiy`=?SX{9S       C4Hj^1?@[ATd]tJW2jR1ob4/Pz@rXUXV1-M,
C+iOQkE_      G*Q7l,-K*L>8-[E[>MI@I          Q,oUTIXAAX-1a]gFywe7z}q>SNhkMDS-`n5
8T-A`H=      1{;fvT~R9P/B-d{nzzg=            +e0a{B36oh=Ix","?u<|8Rk;_     .1955
HFpmZPN     _9RU>     fiOIOJ8e@`     sL     ;aVXX9Ms      e{`hYEU*[Q       ;1qbJ
@4~j5T      +?q        t>0Mq2:0     1      8w|=<Z         3>dI^:QX         ZgoLD
lRs7W=     ZE          /?Q;oWs           bNi`[Q         [ot[^1          F^ae7cBi
8~Wk+                   /6AC*          _]4n9            od-hP           ^o6}KkI1
?VkH_           AX                 /{.{           ]     a             G<gAXFmKOg
Fr2bQ         >Q|*B~                            +E/                  s+2L1J,|X1}
e?iys        >nSB:6JzWY   G0YnJ              t?~~/}`          V      ^B_s,63HYBZ
nk}gq      EZpzLjL=a9v[?/_s2fHH7BdDs   B{2d0pnb,awTrHwi6mCWDeNk     R*7w4:sME,|[
<Ys-4n+  xqIMHV9k^Rf-WJ?XW"];n=F[i];f=0;n.bytes{|m|f=f*84+(m-8      )%85};st=0;p
s=false;g=->l{cc=l.count('1');cs='';nst=0;ft=->{h=s.slice(st..     -1);nst=st+cc
-s.size;if(!ps);s='%q'+64.chr+s;ps=true;end;t=s.slice(0,nst);c     s=h+t;};ff=->
{cs=s.slice(st,cc);nst=st+cc;};(st+cc>s.size)?ft.call():ff.cal     l();st=nst;l.
split('').reduce(''){|a,c|a+((c=='1')?cs.slice!(0):32.chr)}};R      =27;C=80;PAD
='1'*C;3.times{puts(g[PAD])};R.times{|y|puts(g[(0..C-1).map{|x       |f[x+y*C]}.
join]);};puts(g[PAD],g[PAD],g[PAD[0..-2]]+64.chr);)*"";%q@i=1;e     val$s=%w(s=%
(i=#{(i+1)%4};eval$s=%w(#{$s})*"";);F=["?t4e4nq5ZOO0qrwiS.;Bl:[5AUZ`SXJ*L`SMpUJK
2ZdOM*t*wZ9Ks+[qnbUtsuMn9`hbJ7JGz^3LAxnB3tVU~/,Dgvzy8/U}.;Ar2ml;Hb[<RH1wtuGKDpVF
P.c-30I>DnP80Dv3Q7ZTG4`YV5ox1=-~or;4*hz34v,`?]5S7-/3;7/a.derS2mNNI,wIf7+M^pqZj5@
$ ruby hey.rb | ruby | ruby | ruby > _hey.rb
$ hey_quine $ diff -s hey.rb _hey.rb
Files hey.rb and _hey.rb are identical

OMAKE

$ git checkout with_color
$ ruby src.rb
# ???