Hatena::ブログ(Diary)

まめめも このページをアンテナに追加 RSSフィード

2010-09-05

[] The Qlobe

RubyConf に参加するためには、やっぱり 山手 quine みたいに東京限定ネタは通じにくいですよね。これからは Quine もグローバルでないといけないと感じました。

でも世界的に有名な環状線とか知らないので、世界的に有名な回るものを書いてみました。

v=0000;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       "%.#%  :::##"       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     "##%      ::##########"     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "##:         ###############"    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "#            #.   .####:#######"    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "              ##### # :############"   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "              #######################"   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "              ############:####  %#####"   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "              .#############:##%   .##  ."   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  " %%            .################.     #.   "  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  ":####:          :##############%       :   "  ])[n=0].to_i;)%
360)+"al$s=%q#{  "%######.              #########            "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "##########.           #######%             "  |\s|".*"/,"");;
require"zlib"||  "###########           :######.             "  ;d=d.unpack"C*"
d.map{|c|n=(n||  ":#########:           .######: .           "  )*90+(c-2)%91};
e=["%x"%n].pack   " :#######%           :###### #:          "   &&"H*";e=Zlib::
Inflate.inflate(   "  ######%           .####% ::          "   &&e).unpack("b*"
)[0];22.times{|y|   "  ####%             %###             "   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   " .###:             .#%             "   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    " %##                           "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    " #.                        "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     " .                   "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       "#  :#######"       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

実行するごとに経度が 45 度回るので、8 回実行すると元に戻ります。引数整数を与えると、1 度単位で指定した角度だけ回すこともできます。以下、1 回転する様子。

v=0416;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       ".#####%.#% "       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     "    .#####%##%      :"     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "       #####%###:         #"    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "        %########            #."    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "          :#######              ###"   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "            ###:  :              ####"   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "              %#...               #####"   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "                %###               .#####"   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  "                    :. %%            .#####"  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  "                      :####:          :####"  ])[n=0].to_i;)%
360)+"al$s=%q#{  "                      %######.             "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "                      ##########.          "  |\s|".*"/,"");;
require"zlib"||  "                      ###########          "  ;d=d.unpack"C*"
d.map{|c|n=(n||  "                      :#########:          "  )*90+(c-2)%91};
e=["%x"%n].pack   "                      :#######%          "   &&"H*";e=Zlib::
Inflate.inflate(   "                      ######%          "   &&e).unpack("b*"
)[0];22.times{|y|   "                     ####%           "   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   "                   .###:           "   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    "                 %##           "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    "               #.          "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     "            .        "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       " .#####  :#"       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

v=0341;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       "#% .#####%."       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     " :        %#####%##. "     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "              #####%###:   "    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "                %########      "    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "                   :#######        "   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "                     :###   :        "   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "                        %#...          "   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "                          .###:          "   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  "                               :. %%       "  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  "                                 :####:    "  ])[n=0].to_i;)%
360)+"al$s=%q#{  "                                 %######.  "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "                                 ##########"  |\s|".*"/,"");;
require"zlib"||  "%                                ##########"  ;d=d.unpack"C*"
d.map{|c|n=(n||  "                                 :#########"  )*90+(c-2)%91};
e=["%x"%n].pack   "                                 ########"   &&"H*";e=Zlib::
Inflate.inflate(   "#.                              ######%"   &&e).unpack("b*"
)[0];22.times{|y|   "##                            :####. "   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   "#.                          .###:  "   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    "%    .                   %##   "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    "   .                  #.   "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     "                 :   "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       "#.  .##### "       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

v=0264;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       "####% .####"       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     "#####  :       .#####"     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "######.              #####%"    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "####:  .                %######"    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "####  .                     :######"   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "####%                          ###:  "   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "###                               %#..."   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "##  ..                               %###"   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  ":#.  .                                    :"  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  ":   : :                                    "  ])[n=0].to_i;)%
360)+"al$s=%q#{  "% %#:                                      "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "#::#.:  %#%                                "  |\s|".*"/,"");;
require"zlib"||  "  :      :#%                               "  ;d=d.unpack"C*"
d.map{|c|n=(n||  "       :% :                                "  )*90+(c-2)%91};
e=["%x"%n].pack   "     %###%%                              "   &&"H*";e=Zlib::
Inflate.inflate(   "   ########.                           "   &&e).unpack("b*"
)[0];22.times{|y|   "   ########.                         "   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   "   ##:%###.                        "   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    "       %%    .                 "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    "          .                "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     "                     "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       "####.  .###"       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

v=0207;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       "#######% .#"       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     "##########: :        "     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "#############.             "    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "############:  .               "    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "#############  .                   "   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "##############                       "   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "#  %#########                          "   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "    %#:  %##:  :                         "   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  "     #.   .:#.  .                          "  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  "      :    :   : :                         "  ])[n=0].to_i;)%
360)+"al$s=%q#{  "          :% %#:                           "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "           #::#.:  %#%                     "  |\s|".*"/,"");;
require"zlib"||  "             :      :#%                    "  ;d=d.unpack"C*"
d.map{|c|n=(n||  "                  :% :                     "  )*90+(c-2)%91};
e=["%x"%n].pack   "               .###%#                    "   &&"H*";e=Zlib::
Inflate.inflate(   "             ########.                 "   &&e).unpack("b*"
)[0];22.times{|y|   "            :########                "   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   "            ##:%###.               "   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    "               %%    .         "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    "                 .         "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     "                     "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       "#######.  ."       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

v=0132;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       ":::#######%"       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     "################  :  "     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "####################.      "    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "  .####:############:  .       "    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "# # :#################  .          "   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "#######################%             "   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "######:####  %#########                "   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "#######:##%   .##  .###  ..              "   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  "##########.     #.   .:#.  .               "  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  "#########%       :    :   : :              "  ])[n=0].to_i;)%
360)+"al$s=%q#{  "#########            :% %#:                "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "#######%              #::#.:  %#%          "  |\s|".*"/,"");;
require"zlib"||  ":######.                :      :#%         "  ;d=d.unpack"C*"
d.map{|c|n=(n||  ".######: .                   :% :          "  )*90+(c-2)%91};
e=["%x"%n].pack   ":###### #:                %###%%         "   &&"H*";e=Zlib::
Inflate.inflate(   ".####% ::              ########.       "   &&e).unpack("b*"
)[0];22.times{|y|   " %###                 ########.      "   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   " .#%                 ##:%###.      "   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    "                       %%    . "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    "                        .  "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     "                     "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       "##########."       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

v=0055;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       "%  :::#####"       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     "   .:################"     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "     ######################"    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "     #.   .####:############:  "    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "     ##### # :#################  . "   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "    :############################    "   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "    ############:####  %#########      "   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "    %############:###    %#:  %##:  :    "   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  "    .################.     #.   .:#.  .    "  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  "     :##############%       :    :   : :   "  ])[n=0].to_i;)%
360)+"al$s=%q#{  "           #########            :% %#:     "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "           #######%              #::#.:  %#"  |\s|".*"/,"");;
require"zlib"||  "           :######.                :      :"  ;d=d.unpack"C*"
d.map{|c|n=(n||  "           .######: .                   :% "  )*90+(c-2)%91};
e=["%x"%n].pack   "           ######%:#                .###%"   &&"H*";e=Zlib::
Inflate.inflate(   "          .####% ::              ######"   &&e).unpack("b*"
)[0];22.times{|y|   "          .###:                :#####"   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   "          .#%                 ##:%#"   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    "                               "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    "                           "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     "                     "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       ":##########"       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

v=0000;eval$s=%q~d=%!^Lcf<LK8,                  _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC       "%.#%  :::##"       97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B     "##%      ::##########"     O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y?    "##:         ###############"    g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W    "#            #.   .####:#######"    lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<.   "              ##### # :############"   R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5   "              #######################"   00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ   "              ############:####  %#####"   EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q   "              .#############:##%   .##  ."   /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!;  " %%            .################.     #.   "  ;s="v=%04o;ev"%
(;v=(v-($*+[45,  ":####:          :##############%       :   "  ])[n=0].to_i;)%
360)+"al$s=%q#{  "%######.              #########            "  ;;"%c"%126+$s<<
126}";d.gsub!(/  "##########.           #######%             "  |\s|".*"/,"");;
require"zlib"||  "###########           :######.             "  ;d=d.unpack"C*"
d.map{|c|n=(n||  ":#########:           .######: .           "  )*90+(c-2)%91};
e=["%x"%n].pack   " :#######%           :###### #:          "   &&"H*";e=Zlib::
Inflate.inflate(   "  ######%           .####% ::          "   &&e).unpack("b*"
)[0];22.times{|y|   "  ####%             %###             "   ;w=(Math.sqrt(1-(
(y*2.0-21)/22)**(;   " .###:             .#%             "   ;2))*23).floor;(w*
2-1).times{|x|u=(e+    " %##                           "    )[y*z=360,z]*2;u=u[
90*x/w+v+90,90/w];s[(    " #.                        "    ;y*80)+120-w+x]=(""<<
32<<".:%#")[4*u.count((     " .                   "     ;"0"))/u.size]}};;puts\
s+";_ The Qlobe#{" "*18+ (       "#  :#######"       ;"Copyright(C).Yusuke End\
oh, 2010")}";exit~;_ The Qlobe                  Copyright(C).Yusuke Endoh, 2010

JonasJonas 2010/09/07 04:44 Fantastic!

infinityinfinity 2010/12/20 08:43 Very cool!

comboycomboy 2010/12/20 10:36 That is the single most amazing thing ever written in ruby. Thank you!

InetgateInetgate 2010/12/20 10:46 このエントリ、YcombinatorのHacker Newsで取り上げられていますね。
http://news.ycombinator.com/item?id=2022819

ku-ma-meku-ma-me 2010/12/20 12:45 Jonas, comboy:
Thanks. FYI, you can read some "important" articles of my blog in English, such as: http://mamememo.blogspot.com/2010/09/qlobe.html

Inetgate さん:
おお、教えてくれてありがとうございます。タイミング的にイカ娘 (http://d.hatena.ne.jp/ku-ma-me/20101215/p1) が Hacker News 入りしたのかと一瞬焦りました。
しかし、今更な感じですね。英語版は早々に取り上げられていたのですが (http://news.ycombinator.com/item?id=1667093) 。口コミの広がり方は面白い。

neqneq 2010/12/20 21:41 pure awesomeness! :)

スパム対策のためのダミーです。もし見えても何も入力しないでください
ゲスト


画像認証