LoginSignup
7
6

More than 5 years have passed since last update.

ズンドコキヨシ Quine with Ruby

Posted at

ズンドコキヨシ Quine

あなたの知らない超絶技巧プログラミングの世界を読んだら書けた。

zun.rb
f=30;eval$s=%w(s=%(eval$s=%w(#  {$s} )*""  );z="I24142@_M=>
_M=>_M=?_M?<_0:?E=_0:?E<_07>_             04BMB_02H8S_02
J6Q_<6<4O_<6<4M_<FI";d=">2414             2M_B=M_B=M_B=M
_B=M_B=M_BN<_LD<_BN<_B=M_B=M_             B=M_B=M_B=M_B=M
_B=M";k="06:_D3H28_D3H28_D3H4               8_06:C<_06:C
          <48=8_D3H48=8_D                     3H68;8_D3HE<_
          06:C<C>_06:C<2M                     _06:7H2K_06:
       7H2I_06:7H2E";
    sp=0x20.chr;f=(f<<                             1&31)+rand(2);aa=p
  roc{|t|t.split('_').map{        |l|l.chars.map{|x|x.ord-0x30}.map.w
  ith_index{|x,i|(i.even?)?(      '#'*x):(sp*x)}.join}.join($/);};c
d=aa[[z,d][f      &1]].gsub('1    2','#'+sp).gsub('#'){c=s.slice!
(0,1);c==''?      '#':c};puts(    "f=#{f};#{cd}");puts;puts(aa[
k]+$/*2)&&ex                      it()if(f==1);;)*""#######
doko.rb
f=31;eval$s=%w(s=%(  eval $s=%  w(#{$s})*"");z="I24142@_M=>_M
=>_M=?_M?<_0:?E=_0             :?E<_07>_04BMB_02H8S_02J6Q_<6
<4O_<6<4M_<FI";d="             >24142M_B=M_B=M_B=M_B=M_B=M_B
N<_LD<_BN<_B=M_B=M             _B=M_B=M_B=M_B=M_B=M";k="06:_
D3H28_D3H28_D3H48_             06:C<_06:C<48=8_D3H48=8_D3H68
;8_D3HE<_06:C<C>_0             6:C<2M_06:7H2K_06:7H2I_06:7H2
E";sp=0x20.chr;f=(                              f<<1&31)+ran
d(2);aa=proc{|t|t.split('_')                    .map{|l|l.ch
ars.map{|x|x.ord-0                              x30}.map.wit
h_index{|x,i|(i.ev             en?)?('#'*x):(sp*x)}.join}.jo
in($/);};cd=aa[[z,             d][f&1]].gsub('12','#'+sp).gs
ub('#'){c=s.slice!             (0,1);c==''?'#':c};puts("f=#{
f};#{cd}");puts;pu             ts(aa[k]+$/*2)&&exit()if(f==1
);;)*""###########             #############################
##################             #############################
##################             #############################

実行例

   _╰╰,   /バショ % ~/tmp
  _/o ŏァ  / タイチョー% ヤバイ
∈ミ;ノ,ノ   \コマンド% ruby doko.rb | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr | ruby | tee /dev/stderr
f=31;eval$s=%w(s=%(  eval $s=%  w(#{$s})*"");z="I24142@_M=>_M
=>_M=?_M?<_0:?E=_0             :?E<_07>_04BMB_02H8S_02J6Q_<6
<4O_<6<4M_<FI";d="             >24142M_B=M_B=M_B=M_B=M_B=M_B
N<_LD<_BN<_B=M_B=M             _B=M_B=M_B=M_B=M_B=M";k="06:_
D3H28_D3H28_D3H48_             06:C<_06:C<48=8_D3H48=8_D3H68
;8_D3HE<_06:C<C>_0             6:C<2M_06:7H2K_06:7H2I_06:7H2
E";sp=0x20.chr;f=(                              f<<1&31)+ran
d(2);aa=proc{|t|t.split('_')                    .map{|l|l.ch
ars.map{|x|x.ord-0                              x30}.map.wit
h_index{|x,i|(i.ev             en?)?('#'*x):(sp*x)}.join}.jo
in($/);};cd=aa[[z,             d][f&1]].gsub('12','#'+sp).gs
ub('#'){c=s.slice!             (0,1);c==''?'#':c};puts("f=#{
f};#{cd}");puts;pu             ts(aa[k]+$/*2)&&exit()if(f==1
);;)*""###########             #############################
##################             #############################
##################             #############################

f=31;eval$s=%w(s=%(  eval $s=%  w(#{$s})*"");z="I24142@_M=>_M
=>_M=?_M?<_0:?E=_0             :?E<_07>_04BMB_02H8S_02J6Q_<6
<4O_<6<4M_<FI";d="             >24142M_B=M_B=M_B=M_B=M_B=M_B
N<_LD<_BN<_B=M_B=M             _B=M_B=M_B=M_B=M_B=M";k="06:_
D3H28_D3H28_D3H48_             06:C<_06:C<48=8_D3H48=8_D3H68
;8_D3HE<_06:C<C>_0             6:C<2M_06:7H2K_06:7H2I_06:7H2
E";sp=0x20.chr;f=(                              f<<1&31)+ran
d(2);aa=proc{|t|t.split('_')                    .map{|l|l.ch
ars.map{|x|x.ord-0                              x30}.map.wit
h_index{|x,i|(i.ev             en?)?('#'*x):(sp*x)}.join}.jo
in($/);};cd=aa[[z,             d][f&1]].gsub('12','#'+sp).gs
ub('#'){c=s.slice!             (0,1);c==''?'#':c};puts("f=#{
f};#{cd}");puts;pu             ts(aa[k]+$/*2)&&exit()if(f==1
);;)*""###########             #############################
##################             #############################
##################             #############################

f=30;eval$s=%w(s=%(eval$s=%w(#  {$s} )*""  );z="I24142@_M=>
_M=>_M=?_M?<_0:?E=_0:?E<_07>_             04BMB_02H8S_02
J6Q_<6<4O_<6<4M_<FI";d=">2414             2M_B=M_B=M_B=M
_B=M_B=M_BN<_LD<_BN<_B=M_B=M_             B=M_B=M_B=M_B=M
_B=M";k="06:_D3H28_D3H28_D3H4               8_06:C<_06:C
          <48=8_D3H48=8_D                     3H68;8_D3HE<_
          06:C<C>_06:C<2M                     _06:7H2K_06:
       7H2I_06:7H2E";
    sp=0x20.chr;f=(f<<                             1&31)+rand(2);aa=p
  roc{|t|t.split('_').map{        |l|l.chars.map{|x|x.ord-0x30}.map.w
  ith_index{|x,i|(i.even?)?(      '#'*x):(sp*x)}.join}.join($/);};c
d=aa[[z,d][f      &1]].gsub('1    2','#'+sp).gsub('#'){c=s.slice!
(0,1);c==''?      '#':c};puts(    "f=#{f};#{cd}");puts;puts(aa[
k]+$/*2)&&ex                      it()if(f==1);;)*""#######

f=28;eval$s=%w(s=%(eval$s=%w(#  {$s} )*""  );z="I24142@_M=>
_M=>_M=?_M?<_0:?E=_0:?E<_07>_             04BMB_02H8S_02
J6Q_<6<4O_<6<4M_<FI";d=">2414             2M_B=M_B=M_B=M
_B=M_B=M_BN<_LD<_BN<_B=M_B=M_             B=M_B=M_B=M_B=M
_B=M";k="06:_D3H28_D3H28_D3H4               8_06:C<_06:C
          <48=8_D3H48=8_D                     3H68;8_D3HE<_
          06:C<C>_06:C<2M                     _06:7H2K_06:
       7H2I_06:7H2E";
    sp=0x20.chr;f=(f<<                             1&31)+rand(2);aa=p
  roc{|t|t.split('_').map{        |l|l.chars.map{|x|x.ord-0x30}.map.w
  ith_index{|x,i|(i.even?)?(      '#'*x):(sp*x)}.join}.join($/);};c
d=aa[[z,d][f      &1]].gsub('1    2','#'+sp).gsub('#'){c=s.slice!
(0,1);c==''?      '#':c};puts(    "f=#{f};#{cd}");puts;puts(aa[
k]+$/*2)&&ex                      it()if(f==1);;)*""#######

f=24;eval$s=%w(s=%(eval$s=%w(#  {$s} )*""  );z="I24142@_M=>
_M=>_M=?_M?<_0:?E=_0:?E<_07>_             04BMB_02H8S_02
J6Q_<6<4O_<6<4M_<FI";d=">2414             2M_B=M_B=M_B=M
_B=M_B=M_BN<_LD<_BN<_B=M_B=M_             B=M_B=M_B=M_B=M
_B=M";k="06:_D3H28_D3H28_D3H4               8_06:C<_06:C
          <48=8_D3H48=8_D                     3H68;8_D3HE<_
          06:C<C>_06:C<2M                     _06:7H2K_06:
       7H2I_06:7H2E";
    sp=0x20.chr;f=(f<<                             1&31)+rand(2);aa=p
  roc{|t|t.split('_').map{        |l|l.chars.map{|x|x.ord-0x30}.map.w
  ith_index{|x,i|(i.even?)?(      '#'*x):(sp*x)}.join}.join($/);};c
d=aa[[z,d][f      &1]].gsub('1    2','#'+sp).gsub('#'){c=s.slice!
(0,1);c==''?      '#':c};puts(    "f=#{f};#{cd}");puts;puts(aa[
k]+$/*2)&&ex                      it()if(f==1);;)*""#######

f=16;eval$s=%w(s=%(eval$s=%w(#  {$s} )*""  );z="I24142@_M=>
_M=>_M=?_M?<_0:?E=_0:?E<_07>_             04BMB_02H8S_02
J6Q_<6<4O_<6<4M_<FI";d=">2414             2M_B=M_B=M_B=M
_B=M_B=M_BN<_LD<_BN<_B=M_B=M_             B=M_B=M_B=M_B=M
_B=M";k="06:_D3H28_D3H28_D3H4               8_06:C<_06:C
          <48=8_D3H48=8_D                     3H68;8_D3HE<_
          06:C<C>_06:C<2M                     _06:7H2K_06:
       7H2I_06:7H2E";
    sp=0x20.chr;f=(f<<                             1&31)+rand(2);aa=p
  roc{|t|t.split('_').map{        |l|l.chars.map{|x|x.ord-0x30}.map.w
  ith_index{|x,i|(i.even?)?(      '#'*x):(sp*x)}.join}.join($/);};c
d=aa[[z,d][f      &1]].gsub('1    2','#'+sp).gsub('#'){c=s.slice!
(0,1);c==''?      '#':c};puts(    "f=#{f};#{cd}");puts;puts(aa[
k]+$/*2)&&ex                      it()if(f==1);;)*""#######

f=1;eval$s=%w(s=%(  eval $s=%  w(#{$s})*"");z="I24142@_M=>_M
=>_M=?_M?<_0:?E=_0             :?E<_07>_04BMB_02H8S_02J6Q_<6
<4O_<6<4M_<FI";d="             >24142M_B=M_B=M_B=M_B=M_B=M_B
N<_LD<_BN<_B=M_B=M             _B=M_B=M_B=M_B=M_B=M";k="06:_
D3H28_D3H28_D3H48_             06:C<_06:C<48=8_D3H48=8_D3H68
;8_D3HE<_06:C<C>_0             6:C<2M_06:7H2K_06:7H2I_06:7H2
E";sp=0x20.chr;f=(                              f<<1&31)+ran
d(2);aa=proc{|t|t.split('_')                    .map{|l|l.ch
ars.map{|x|x.ord-0                              x30}.map.wit
h_index{|x,i|(i.ev             en?)?('#'*x):(sp*x)}.join}.jo
in($/);};cd=aa[[z,             d][f&1]].gsub('12','#'+sp).gs
ub('#'){c=s.slice!             (0,1);c==''?'#':c};puts("f=#{
f};#{cd}");puts;pu             ts(aa[k]+$/*2)&&exit()if(f==1
);;)*""###########             #############################
##################             #############################
##################             #############################

      ##########
####################   ########################  ########
####################   ########################  ########
####################   ########################    ########
      ##########                   ############
      ##########                   ############    ########             ########
####################   ########################    ########             ########
####################   ########################      ########           ########
####################   ########################                     ############
      ##########                   ############                   ##############
      ##########                   ############  #############################
      ##########       ########################  ###########################
      ##########       ########################  #########################
      ##########       ########################  #####################

f=2;eval$s=%w(s=%(eval$s=%w(#  {$s} )*""  );z="I24142@_M=>
_M=>_M=?_M?<_0:?E=_0:?E<_07>_             04BMB_02H8S_02
J6Q_<6<4O_<6<4M_<FI";d=">2414             2M_B=M_B=M_B=M
_B=M_B=M_BN<_LD<_BN<_B=M_B=M_             B=M_B=M_B=M_B=M
_B=M";k="06:_D3H28_D3H28_D3H4               8_06:C<_06:C
          <48=8_D3H48=8_D                     3H68;8_D3HE<_
          06:C<C>_06:C<2M                     _06:7H2K_06:
       7H2I_06:7H2E";
    sp=0x20.chr;f=(f<<                             1&31)+rand(2);aa=p
  roc{|t|t.split('_').map{        |l|l.chars.map{|x|x.ord-0x30}.map.w
  ith_index{|x,i|(i.even?)?(      '#'*x):(sp*x)}.join}.join($/);};c
d=aa[[z,d][f      &1]].gsub('1    2','#'+sp).gsub('#'){c=s.slice!
(0,1);c==''?      '#':c};puts(    "f=#{f};#{cd}");puts;puts(aa[
k]+$/*2)&&ex                      it()if(f==1);;)*""#######

f=5;eval$s=%w(s=%(  eval $s=%  w(#{$s})*"");z="I24142@_M=>_M
=>_M=?_M?<_0:?E=_0             :?E<_07>_04BMB_02H8S_02J6Q_<6
<4O_<6<4M_<FI";d="             >24142M_B=M_B=M_B=M_B=M_B=M_B
N<_LD<_BN<_B=M_B=M             _B=M_B=M_B=M_B=M_B=M";k="06:_
D3H28_D3H28_D3H48_             06:C<_06:C<48=8_D3H48=8_D3H68
;8_D3HE<_06:C<C>_0             6:C<2M_06:7H2K_06:7H2I_06:7H2
E";sp=0x20.chr;f=(                              f<<1&31)+ran
d(2);aa=proc{|t|t.split('_')                    .map{|l|l.ch
ars.map{|x|x.ord-0                              x30}.map.wit
h_index{|x,i|(i.ev             en?)?('#'*x):(sp*x)}.join}.jo
in($/);};cd=aa[[z,             d][f&1]].gsub('12','#'+sp).gs
ub('#'){c=s.slice!             (0,1);c==''?'#':c};puts("f=#{
f};#{cd}");puts;pu             ts(aa[k]+$/*2)&&exit()if(f==1
);;)*""###########             #############################
##################             #############################
##################             #############################

(略)

その他のキヨシ

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6