SlideShare una empresa de Scribd logo
1 de 44
Descargar para leer sin conexión
Esoteric, Obfuscated, Artistic
Programming in Ruby
Yusuke Endoh (@mametter)
Cookpad Inc.
RubyConf 2017 (2017/11/17)
Yusuke Endoh (@mametter)
• MRI committer
• @ Cookpad Inc.
– w/ @ko1
– Ko1: performance improvement
– me: "Make Ruby programs robust"
My contributions for Ruby
• The release manager for 2.0
• Implemented coverage.so,
keyword arguments, etc.
• OptCarrot: A NES emulator
for Ruby3x3 benchmark
• Branch coverage (Ruby 2.5)
↑OptCarrot .
https://eregon.me/blog/2016/11/28/optcarrot.html
http://engineering.appfolio.com/appfolio-engineering/2017/9/22/optcarrot-an-excellent-cpu-benchmark-for-ruby-3x3
Today's Topic: Ruby's power
• "Ruby is easy to read and write"?
– Incorrect
• Ruby is just rich and flexible
– Easy to write an easy-to-read code
– Also, easy to write a hard-to-read code
• I show you my bad examples
– (Note: I'll talk about nothing useful)
Can you read?
@_="_"=~/$/;_=@_+@_;$><<(""<<(_*_*_+@_)*_*_*_<<
((_+@_)*_*_*_+@_)*_*_+@_<<(((_+@_)*_*_+@_)*_+@_
)*_ *_ << ( ( (_+@_ )*_*_+
@_) * _+ + @_) * _*_ <<((((+
_+@_)*_ * _+ + +@_ )*_+@_)*
_++ @_ )* _ ++@_ <<((_*_+@_
)*_ + + + @_)* _*_ <<_*_*_*_*
_<< ( (_ * _ +@_) *_*_*_++@_
)*_<<(((_++@_)*_+@_)*_*_+@_)*_*_+@_<<((_+@_)*_*
_*_*_ +@_)* _<<( ( (_+ +@_
)*_ ++ @_ ) *_+
@_) *_*_*_+ @_<< ( _* _ *_*_*_++
@_) *_+@_<< (((( _ ++ + +@_)*
_*_ ++ @_ )* _ +@_)*_++
@_)*_ +@_<< (((( _+ + @_)*_*_+
@_)*_+@_)*_+@_)*_<<(((_+@_)*_*_*_+@_)*_+@_)*_<<
_*_*_*_*_+@_<<(_*_+@_)*_)#_$`/^|:()[_-|?|_||:`/
Can you read?
@_="_"=~/$/;_=@_+@_;$><<(""<<(_*_*_+@_)*_*_*_<<
((_+@_)*_*_*_+@_)*_*_+@_<<(((_+@_)*_*_+@_)*_+@_
)*_ *_ << ( ( (_+@_ )*_*_+
@_) * _+ + @_) * _*_ <<((((+
_+@_)*_ * _+ + +@_ )*_+@_)*
_++ @_ )* _ ++@_ <<((_*_+@_
)*_ + + + @_)* _*_ <<_*_*_*_*
_<< ( (_ * _ +@_) *_*_*_++@_
)*_<<(((_++@_)*_+@_)*_*_+@_)*_*_+@_<<((_+@_)*_*
_*_*_ +@_)* _<<( ( (_+ +@_
)*_ ++ @_ ) *_+
@_) *_*_*_+ @_<< ( _* _ *_*_*_++
@_) *_+@_<< (((( _ ++ + +@_)*
_*_ ++ @_ )* _ +@_)*_++
@_)*_ +@_<< (((( _+ + @_)*_*_+
@_)*_+@_)*_+@_)*_<<(((_+@_)*_*_*_+@_)*_+@_)*_<<
_*_*_*_*_+@_<<(_*_+@_)*_)#_$`/^|:()[_-|?|_||:`/
Demo
• "Hello, RubyConf!" program written
using only symbol characters
$ ruby symbols.rb
Hello, RubyConf!
$
Spoiler
• If you want to read it yourself…
• Three key techniques
– How to make a number (by only symbols)
– How to make a string (by only symbols)
– How to print a string (by only symbols)
Spoiler: How to make a number
• String#=~ returns the beginning index
of matched substring
• Calculation to make a large number
"Hello, RubyConf!" by Symbols
"@" =~ /$/ #=> 1
"@@" =~ /$/ #=> 2
"@@@" =~ /$/ #=> 3
_ = ("@@"=~/$/) # assigns 2 to _
_*_*_*_ #=> 16
Spoiler: How to make a string
• String#<< treats an integer as a
codepoint (ASCII code)
"Hello, RubyConf!" by Symbols
"" << 72 << 101 << 108 << 108 << 111
#=> "Hello"
Spoiler: How to print a string
• $> is $stdout
• IO#<< writes its argument to the IO
"Hello, RubyConf!" by Symbols
$> << "Hello"
Spoiler: Use All Techniques
$> << "Hi"
$> << ("" << 72 << 105)
__ = "_"=~/$/
_ = "__"=~/$/
$> << ("" <<
(_*_*_+__)*_*_*_ <<
((_+__)*_*_+__)*_*_*_+__)
1
2
72
105
"Hello, RubyConf!" by Symbols
Spoiler: More Complex Code?
• Q. Can we write a more complex code
than "Hello, world!"?
• A. Yes! There is a great idiom to call
"eval" by using only symbols
• Exercise: Explain how it works
->(&_){
_["", "eval", "<YOUR RUBY CODE>"]
}[&:"#{ "send" }"]
"Hello, RubyConf!" by Symbols
Replace them by using the previous techniques
Question 2: Can you read?
90-line code by only alphabets!
begin begin begin public begin begin def each
clear rescue begin begin begin end end end
concat begin dup ensure concat begin clear
concat concat concat concat concat concat size
concat begin begin begin size end end end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
begin concat concat size end until hex
concat concat concat concat begin size end
concat concat begin size end rescue upcase
begin concat begin concat size end end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat begin concat size end unless begin end
begin concat concat concat begin size end end
begin begin concat concat size end end
concat begin concat begin size end end
concat concat begin size end unless begin end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat concat begin begin size end end
concat concat concat size unless begin end
concat begin concat size end if downcase
begin concat concat size end rescue upcase
concat begin concat size end unless begin end
concat begin begin begin size end end end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat concat concat concat concat concat size
begin concat concat size end rescue upcase
concat size if downcase rescue upcase
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
begin concat concat begin size end end
begin concat concat size end unless begin end
concat concat begin begin size end end
concat concat begin concat concat size end
begin begin concat size end end if downcase
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
begin concat begin concat size end end
concat concat concat concat concat size
begin concat concat size end rescue upcase
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat concat begin size end if downcase
begin begin concat concat size end end
concat concat concat size rescue upcase
concat concat concat size rescue upcase
begin concat begin size end end rescue upcase
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat concat concat size rescue upcase
concat concat concat begin concat size end
concat begin concat begin size end end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat concat concat concat concat concat size
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
begin concat begin concat concat size end end
concat concat begin size end unless begin end
concat concat concat size unless begin end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat concat begin size end rescue upcase
begin begin concat concat concat size end end
concat begin concat size end unless begin end
concat begin concat begin size end end
begin begin concat concat size end end
begin begin concat size end end rescue upcase
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat begin concat size end rescue upcase
concat begin concat begin concat size end end
begin concat concat size end unless begin end
concat concat begin begin concat size end end
begin size end ensure begin clear end end end
begin begin prepend begin chr end end end
concat begin dup ensure concat begin clear
begin concat concat begin size end end
concat begin concat concat concat size end
begin concat concat concat begin size end end
begin concat begin size end end if downcase
begin size end ensure begin clear end end end
puts concat begin dup ensure concat begin clear
concat begin concat concat concat size end
concat begin concat concat concat size end
size ensure clear end end end end end end
for each in begin inspect end do end end end
begin begin begin public begin begin def each
clear rescue begin begin begin end end end
concat begin dup ensure concat begin clear
concat concat concat concat concat concat size
concat begin begin begin size end end end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
begin concat concat size end until hex
concat concat concat concat begin size end
concat concat begin size end rescue upcase
begin concat begin concat size end end
begin size end ensure begin clear end end end
concat begin dup ensure concat begin clear
concat begin concat size end unless begin end
Demo
• "Hello, RubyConf!" program written
using only alphabets
$ ruby alphabets.rb
Hello, RubyConf!
$
Spoiler: Basic Structure
"Hello, RubyConf!" by Alphabets
s = inspect #=> "main"
s.clear
s.concat 72 #=> add 'H'
s.concat 105 #=> add 'i'
puts s
Need to remove the periods
class String
def foo
self.clear
self.concat 72 #=> add 'H'
self.concat 105 #=> add 'i'
puts self
end
end
inspect.foo
Spoiler: Abuse Open Class
"Hello, RubyConf!" by Alphabets
We can omit "self." !
Need to remove the period
class String
def each
clear
concat 72 #=> add 'H'
concat 105 #=> add 'i'
puts self
end
end
for x in inspect do end
Spoiler: Abuse "for"-statement
"Hello, RubyConf!" by Alphabets
Equivalent to
inspect.each {}
Exercise:
Remove the numbers
and the upper-case letter
Got "Hi" program
By only alnums!
Frequently Asked Question
• Q. Why do I write such a program?
• A. Because it's there.
– To figure out Ruby's power and its limit
– To stress the interpreter with unusual
code
• Q. What inspired me?
• A. Esoteric programming languages
– Funny joke languages including Brainf*ck
and Chef
Brainf*ck
• A language using only eight symbols
– Inspired me to create "Hello by Symbols"
+++++++++[>++++++++>+++++++++++>+++++<<<
]>.>++.+++++++..+++. >-.------------.<++
++++++.---- ----.+++.------.--------.>+.
Hello, world!
in Brainf*ck
Examples of Esolangs
Chef (not a provisioning tool)
• A language where programs look like
cooking recipes
Cheese cake in Chef.
Ingredients.
100 g cream cheese
97 g sour cream
*snip*
Method.
Put the cream cheese into the mixing bowl.
Put the sour cream into the mixing bowl.
*snip*
Examples of Esolangs
Data section
Code section
[PR] Cookpad
• One of the world's largest
recipe sharing platform
• My Cheesecake recipe is
published at Cookpad
– https://cookpad.com/us/
recipes/3335222
– It is a program in Chef
• Prints "cookpad"
– It can be also used as
a real recipe
• Chef (and some esolangs)
inspired me to create
a funny-shaped Ruby code…
Can you read?
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
Demo
$ cat qlobe.rb
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
$ ruby qlobe.rb
v=0473;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
$ ruby qlobe.rb|ruby
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
$ ruby qlobe.rb|ruby|ruby
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
$ ruby qlobe.rb|ruby|ruby|ruby
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
$ ruby qlobe.rb|ruby|ruby|ruby|ruby
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
$ ruby qlobe.rb|ruby|ruby|ruby|ruby|
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
$ ruby qlobe.rb|ruby|ruby|ruby|ruby|
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
$ ruby qlobe.rb|ruby|ruby|ruby|ruby|
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
Qlobe: A Quine with Spinning Globe
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=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=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=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=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=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=0473;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
0°
45°W
90°W
135°W
180°
135°E
90°E
45°E
Spoiler: Two key techniques
• Quine: self-reproducing program
• ASCII-art programs
– Ruby's %-notation works great for them
Spoiler: Quine
• A program that prints its source code
• Basic structure
eval s=%q(
s="eval s=%q(#{s})"
# Do funny thing here!
# e.g., Rotate the globe in the string
puts s
)
Qlobe: A Quine with Spinning Globe
Reconstruct the
original code
as a string
Print it
Spoiler: ASCII-art code
• Write a code with no space and backslash
• Wrap it with "eval(%w(" and ").join)"
• You can shape your code as you like
puts"Hello,world!"
eval(%w(puts"Hello,world!").join)
eval(%w(pu
ls "H
el lo
,w or
ld!")*"")#
#=> Hello,world!
Quine-relay
eval$s=%q(eval(%w(B=92.chr;g=32.chr;puts(eval(%q(N=10.chr;n=0;e=->s{Q[Q[s,B],?"].K(N,B+?n)};E=->s{'("'+e[s]+'")'};d=->s,t=?"{s.K(t){t+t}};def~f(s,n)s.K(/.{1,#{n*255}}/m){yield$S=E[$s=$&]}end;Q=->s,t=?${s.K(t){B+$&}};R=";return~0;";V=->
s,a,z{s.K(/(#{B*4})+/){a+"#{$&.size/2}"+z}};C=%w(System.Console~Write);$C=C*?.;$D="program~QR";$G="~contents~of"+$F="~the~mix!g~bowl";$L="public~static";rp=->s,r{v="";[r.!ject(s){|s,j|o={};m=n=0;s.size.times{|i|o[f=s[i,2]]||=0;c=o[f]+=
1;m<c&&(m=c;n=f)};v=n+v;s.K(n,(j%256).chr)},v]};%(fn~mX{Z`x21("{}",#{E["object~QR~extends~App{#{f(%((display~"#{e[%(Zf("1d;s/.//;s/1/~the~sum~of~a~son~and0/g;s/0/~twice/g;s/2/`x59ou~are~as~bad~as/g;s/3/~a~son`x21Speak~your~m!d`x21/g^n#
The~Relay~of~Qu!e.^n#Ajax,~a~man.^n#Ford,~a~man.^n#Act~i:~Qu!e.^n#Scene~i:~Relay.^n#[Enter~Ajax~and~Ford]^n#Ajax:^n#");function[]=f(s);for~i=1:2:length(s),Zf("2%s3",part(dec2b!(hex2dec(part(s,i:i+1))),$:-1:2)),end;endfunction`n#{s,v=rp
["Transcript~show:~'#{d["Z"+E[%(fun~p~n=Z(Int.toSJ~n`x5e"~");p~0;p~0;p~130;List.tabulate(127,p);SJ.map(fn~c=>(p(3+ord~c);Z"-1~0~";c))#{E[%(puts~"#{Q[e[%(echo~'a::=`x7e#{Q[Q["let~s=#{E["!t~mX{Z#{d[E[%(module~QR;!itial~beg!~#{f("let~s=#{
E[%(Module~QR:Sub~MX:Dim~s,n,i,c~As~Object:n=Chr(10):For~Each~c~!"#{d["<?xml#{O="~version='1.0'"}?><?xml-#{I="stylesheet"}~type='text/xsl'href='QR.xslt'?><xsl:#{I+O}~xmlns:xsl='http://www.w3.org/1999/`x58SL/Transform'><xsl:output~metho
d='text'/><#{U="xsl:template"}~match='/'><`x21[CDATA[#{%(sub~f(s$,n)Z(s$);:for~i=1to~n~Z("Y");:next:end~sub:f("#{V[e[%(H,format="#{y="";f("^H{-}{txt}{#{Q["echo~-E~$'#{Q[Q[E[%(with~Ada.Text_Io;procedure~qr~is~beg!~Ada.Text_Io.Put("#{d[%
(!terp:library"afnix-sio"`ntrans~O(n){trans~o(afnix:sio:OutputTerm)`no:H(Byte(+~128~n))}`ntrans~f(v~n){`nO(+(/~n~64)107)`nO(n:mod~64)`nO~v}`ntrans~D(n){if(<~n~4){f(+(*~6~n)9)48}{if(n:odd-p){D(-~n~3)`nf~27~48`nf~36~11}{D(/~n~2)`nf~21~48
`nf~48~20}}}`ntrans~S"#{e[%W[STRINGz:=~226+~153,a:=z+~16 6,b:=a+"2 "+z+~160,c:=b+"8"+z+~165,t:="#!clude<iostream>"+~(10)+"!t"+~(32)+"mX{puts#{d[E[%(class~QR{#$L~void~ma!(SJ[]v){System.out.Z(#{E["H('#{Q[e["implement~ma!0()=Z"+E["BEGIN{
Z#{E[%(echo~'#{%(f(s){System.out.Z(s);}s="389 **6+44 *6+0 0p45*,"; for(c:#{E[(s="#!clude<iostream>`n!t~mX{std::cout<<#{E[%(class~Program{#$L~void~MX{#$C("Qu!e~Relay~Coffee.^n^nIngredients.^n");for(!t~i=9;i++<126;)#$C($"{i}~
g~caffe!e~{i}^n");#$C("^nMethod.^n");foreac h(c h ar~c~!#{E[%((doseq[s(lazy-cat["IDENTIFICATION~DIVISION.""PROGRAM-ID.~QR.""PROCEDURE~ DIVISION."'DISPLA`x59](map~#(str"~~~~^""(.replace~%1"^"""
^"^"")"^"&")(re-seq~#".{1,45}""#{e["(f=(n )- >Array(n+1).jo!~'Y');console.log('%s',#{V[E[%((H-l!e"#{e["impor t~std.stdio;void~mX{H(`x60#{%(method~MX{Z(@"#{d["
[#{%(class~QR:Application{void~f(SJ~con st~s,!t~n){for(Pr!t(s);n;n--)Pr!t("Y");}void~MX{#{f("IO.puts "+E[%((pr!c~"#{e["`nma!(_)->`nio:fH#{d[E['Zf
n("""'+d[?"+"%option~noyywrap`n%%`n%%` n!t~mX{puts#{E["echo~'#{Q[Q[%(~:~A~."#{g*9}"~;~:~ B~A~."~WRITE(*,*)'"~A~;~:~C~B~T`x59PE~."
~'"~CR~;~:~D~S"~#$D"~C~S^"~Z~^"(&"~C~ S^"~#{e[%(Z"#{e["s:=OutputTextUser();Write All(s,#{E[%(Zf"#{e[d[f('set~Z"-";Z'+E
[%(package~ma!;import"fmt";func~mX{ fmt.Pr!t#{E[%(236:j;{119:i;{206i-:i;.48<{ 71+}{[i]^48-*}if}%}:t;"algoritmo~Q
R;!"[195][173]++'cio~imprima("'"0 1314 1"t"/12131"t~6*"/1:1918151:??62714 13/4=3626612/2 /353251215/`x5a0`x5a0R"t"#{e[%(
show~"z=new~java.util.zip.G`x5aI POutp utStream(System.out);z.H('#{ "ma!=putStr"+E["class~QR{#$L ~function~mX{neko.Lib.Z#{E[%(p
rocedure~mX;i:=c:=0;s:=#{E[%(.c lass ~public~QR`n.super~#{$T="ja va/io/Pr!tStream"}`n.method~#$L~ma!([L #{S="java/lang/S"}J;)V~;]`n.
limit~stack~2`ngetstatic~#{S}ys tem/out~L#$T;`nldc~"#{ e[%(class~QR{#$L~void~ ma!(SJ[]v){SJ~c[]=new~SJ[99999],y="",z=y,s=" #{z=t=(0..r=q=126).map{|n|
[n,[]]};a="";b=->n{a<<(n%78+55) %84+ 42};(%(P={0:'[+[]]',m:'((+[])'+(C= "['constructor']" )+"+[])['11']"};for(R~!~B=('`x21[]@`x21`x21[]@[][[ ]]@'+(A="[]['fill']")+"@(
[]+[])['fontcolor']([])@(+('11e20 ')+[])['split']([])@"+A+C+"('return~escape')()("+ A+')').split( '@'))for(E~!~D=eval(G='('+B[R]+'+[])'))P[T=D[E]]=P[T]| |G+"['"+E+"']";for(G='[
',B=0;++B<36;)P[D=B.toSJ(36)]= B<10?(G+='+`x21+[]')+']':P[D]||"(+('"+B+"'))['to'+( []+[])"+C+"[ 'name']]('36')";A+=C+"('console.log(unescape(^"";for(E~!~G =#{E[%(A=Z;A("echo~'k`
x60");[(A("`x60`x60s"`x5e8* "i");for~j=6:-1:0;x=(Int(c)>>j)%2+1;A("`x60"*"kki"[x:x+1 ])end)fo r~c~!~jo!(["Section`x48eader+name:=QR;SectionPublic-ma!<-(";[ "^"$(replace(replace(
s,"Y","YY"),"^"","Y^""))^" .Z;"for~s=matchall(r".{1,99}",#{Q[E["console.log"+Q[E[%(@s=g loba l[#{i=(s=%(`x48AI~1.2`nVISIBLE~"#{"x=sJ.K(#{V[E["changequote(<@,@ >)`ndef!e(p,<@#{"all
:`n`t@echo~'#{d["l!el:99 999;Z#{E["solve~satisfy;output~[#{E[%(.assembly~t{}.method~#$L~ vo id~MX{.entrypo!t~ldstr"#{e["m{{`x21:~x`nqr:~|-`n~:db`x60#{e[s="$Z#{E[%(#!clude< stdio.h>`nmodule~QR{
}implementation{!t~mX_ _attribute__((C,spontaneous)){puts#{E["Zf#{E["echo"+E["#import<stdi o.h>#{ N}!t~mX{puts#{E["Z_sJ"+E["s=toascii#{E["Z#{E["$console:l!e[#{"# $D(output);beg!~H(#
{f((p="eval";%($_="#{ s,v=rp["$_='#{Q[%(<?php~$z=3+$w=strlen($s=#{Q[E["!t~mX{H#{E["(#{?_*11} )dup~=/s(|~~~~~.~~~|)def(#{Q["qr:-H('#{Q[e["!it{#{f (%(Z('cat("')`nfor
~c~!"".jo!(["echo~'s ay~''%s'''^n"%l~for~l~!#{E[d[d["eval$s=%q(#$s)",?'],?']]}.split("^n")]): Z('r=fput(char(%d))'%ord(c))`nZ('end^n")')#),6 ){"Zf#{d[$S,?%]};"
}}}"],?']}').",B]}) {9~7{exch~dup~1~and~79~mul~32~add~exch~2~idiv~3~1~roll~s~exch~2~!dex~exch~p ut~1~sub~dup~6~eq{1~sub}if}repeat~s~=~pop ~pop}forall~=~quit
"]+R}}"]]})*3;echo" ^x89PNG^r^n^x1a^n";$m="";$t="^xc0^0^xff";for($i=-1;++$i<128*$z;$m.=$c--?($w- $c||$i>$z)&&$i/$z<($c<$w?ord($s[(!t)( $c/3)]):$c--%3+2)?
$t[2].$t[$c%3%2].$ t[$c%3]:"^0^0^0":"^0")$c=$i%$z;foreach(array("I`x48DR".pack("NNCV",$w+2,128,8,2 ),"IDAT".gzcompress($m),"IEND")as$ d)echo~pack("NA*N
",strlen($d)-4,$d, crc32($d));).K(B,"`x7f"),?']}';s:g/^x7f/Y/;Z~$_",128..287];s="$_='#{Q[s,c=/['Y]/ ]}';$n=32;$s='#{Q[v,c]}';$s=`x7 es{..}{$a=$&;$b=c
hr(--$n&255);`x7e s/$b/$a/g;}eg;Z";(s+N*(-s.size%6)).unpack("B*")[0].K(/.{6}/){n=$&.to_i~2;((n+14)/2 6*6+n+47).chr}}";s|.|$n=ord $&;substr~unpack(
B8,chr$n-!t($n/32 )*6-41),2|eg;eval~pack'B*',$_).scan(/[~,-:A-z]+|(.)/){p="s++#{$1?"chr~#{$1.ord}+e": $&+?+};"+p};p),1){"'#$s' ,"}}'')end.".K(/[:
;()]/){?`x5e+$&}} ]"]};quit"]};t=num2cell(b=11-ceil(s/13));for~n=1:9m={};for~i=1:141f=@(x,y,n)repmat ( ['Ook'~char(x)~'~Ook' ~char(y)~'~'],[1~a
bs(n)]);m(i)=[f(z =46,63,n)~f(q=z-(i<13)*13,q,i-13)~f(33,z,1)~f(63,z,n)];end;t(x)=m(diff([0~s(x=b= =n )])+13);en d;Zf ('%%s',t{:})"]]+R} }"]]}`n"]};return~
0;}~})]};"]}`x60` n~global~_start`n~_start:mov~edx,#{s.size}`n~mov~ecx,m`n~mov~ebx,1`n~mov~eax,4` n ~!t~128`n~mov ~ebx,0`n~mo v~eax,1`n~!t~12 8`nx:~|`n~}}{{{qr}}
}"]}"call~void~[ms corlib]#{C*"::"}(sJ)ret})]}];"]};quit();",?$].K(?'){"'^''"}}'"}@>)`np"],?&,?& ] },'&(%d+)&',fu nction(s)retur n~sJ. rep('Y',tonu mber(s))end);Z(x)".
K(/[:"]/,":^0")}"` n`x4bT`x48`x58B`x59E~B`x59E)).size+1}x~i8]c"#{s.K(/[^"`n`t]/){"^%02`x58"%$ &. ord}}^00"declare~i32@puts(i8*)d ef!e~i32@mX{ %1=call~i 32@puts(i8*getelemen
tptr([#{i}x~i8],[#{ i}x~i8]*@s,i32~0,i32~0))ret~i32~0})],?#]]]})];");"],"^n")];[for~i=0:2:4; x=(( Int(c)%83-10)>>i)%4+1;A("ski`x60 "[x:x])end~for~c ~!"AG- `x48-`x48Fy.IlD==;=jd
lAy=;=jldltldltl{lAu lAy=jtlldlAyFy=?=jdlAyGFyFyG2AFy>zlAFFBCjldGyGFy>GFy.AGy=G==n`x48==nl ldC=j@=j tlldltldlAut11"];A("'"))]})A+="' +`x21[]+'"+G.charCo deA t(E).toSJ(16);for(A+="
^".replace(/'+`x21[] +'/g,^"%^")))')()",R=0;R<9;R++)A=A.replace(/'.*?'/g,function(B){T= [];for(E=1 ;B[E+1];)T.push(P[B[E++]]);return~T.jo!('+')});conso l e.log('"'+A+'"'))).byte
s{|n|r,z=z[n]||(b[r/7 8];b[r];q<6083&&z[n]=[q+=1,[]];t[n])};b[r/78];b[r]}";!t~i=0,n=0 ,q=0;for(;++n< 126;)c[n]=""+(char)n;for(;i<#{a.size};){q=q*78+(s .charAt(i)-13)%84;if(i++
%2>0){y=q<n?c[q]:y;c[n ++]=z+y.charAt(0);System.out.Z(z=c[q]);q=0;}}}})]}"`n!vokevi rtual~#$T/Zln(L#{S }J;)V`nreturn`n.end~method)+N]};H("DO,1<-#"|| *s);s?while~t:=ord(move(1)
)do{i+:=1;u:=-i;every~0t o~7do{u:=u*2+t%2;t/:=2};H("PLEASE")^(i%4/3);H("DO,1SUB# "||i||"<-#"||((c-u)%2 56));c:=u;};H("PLEASEREADOUT,1^nPLEASEG IVEUP");end)]};}}"].tr(?"+B
,"`x21`x7e")}'.tr('`x7e`x 21','YY^u0022')as~byte[]);z.close()"`n)]}"{"W""w"@j ~1+:j^-~118%1+*}%"/35512 416612G61913@921/17A331513"t'") ;fim')]};})],61){"Zn#$S`n"},?
%]]}"`nquit)]});CloseStream (s);QUIT;"]}")]}"~DUP~A~."~DO~10~I=1,"~.~CR~S "~&A,&"~C~."~10~~~~~~CONTINU E"~CR~S^"~&A)^",&" ~C~0~DO~B~."~&char("~COUNT~.~."
~),&'"~CR~LOOP~S^"~&^"^""~C~S "~end~#$D"~C~A~."~STOP"~CR~A~."~END"~CR ~B`x59E~;~D~),B],?`x21].K(?',%('"' "'))}'"]};}".K(?"){'"34,"'}.K(N){
'"10,"'}+?",?%]+'~""")'],?`x7e] }."]}"))],15){"f(#{V[$S[1..-2] ,'",',');f("']},0);"}}}})}]pq"]}");})} `x60);}"]}"))].K(?`x60,"Yx60"),'#{f
(',')}']})"]}"))["~~~~^"~^".""STO P~RUN."])](Zln( str"message(STATUS~^"~~~~~"(.replace(.replac e(str~s)"Y""YY")"^"""Y^"")"^")")))).re
verse]})#$C($"Put~caffe!e~{(!t)c}~!t o#$F.^n");#$C("Liquify#$G.^nPour#$G~!to~the~bak!g~ dish.^n^nServes~1.^n");}})]};}/****//****
/";t={};b="";L="";n=i=0;D=->n{L<<(n+62) %92+35;D};s.bytes{|c|n>0?n-=1:(t[c]=(t[c]||[]).reject{|j| j<i-3560};x=[];t[c].map{|j|k=(0..90).f!d{|k|n
ot~s[i+1+k]==s[j+k]}||91;k>4&&x<<[k,j]};x=x. max)?(n,j=x;x=b.size;(u=[x,3999].m!;D[u%87][u/87];L<<b[0,u];b[0,u ]="";x-=u)while~x>0;x=4001+i-j;D[x%87][x/87][n-5]
):b<<c;t[c]+=[i+=1]};"#!clude<stdio.h>`nchar*p=#{E [L]},s[999999],*q=s;!t~mX{!t~n,m;for(;*p;){n=(*p-5)%92+(p[1]-5)%92*87;p+=2;if(n >3999)for(m=(*p++-5)%92+6;m--;q++)*q=q[4000-n];else~for(
;n--;)*q++=*p++;}puts(s)#{R}}")]}){s+="00g,";for(m=1;m<256;m*=2)s+="00g,4,:"+(c/m%2>0?"4+":"")+",";f(s);s="4,:,";}f(s+s);for(c:Base64.getDecoder().decode("kaARERE`x58/I0ALn3n5ef6l/Pz8+fnz58/BOf5/7/hE`x58/O`x5azM5mC`x58/Oczm`x5azBPn5+`x
58/OczMznBL/nM5m`x5azBPu++fPPOc5zngnnO`x5azO`x5agnBMGAW7A==")){c=c<0?256+c:c;for(i=0;i++<3;c/=8)f(c%8);f("8*+8*+,");}f("@");).K(?',%('"'"'))}'|sed~-e's/Y/YY/g'~-e's/"/Yq/g'~-e's/.*/Z~"&"^nquit/')]}}"]],?']}');".K(B,?`x5e)]}.replace("`x
5e","Y"));}})]]};}";FORiTO`~UPBtDO`~INTn:=ABSt[i];Z(~(50+n%64)+c+~(50+n%8MOD8)+c+~(50+nMOD8)+b+"`x4a"+a)OD]*"REPR"]}"`ntrans~c~0`ndo{D(Integer(S:get~c))`nf~35~39}(<(c:++)(S:length))`nf~24~149)].K(N,'"&Character'+?'+'Val(10)&"')}");end;
)]+"`nsys.exit~0",B],?']}'",/[^{}]/]}}",35){y<<",`n"+$S;"%s"}}")+y],'",','):f("']}",0))}]]></#{U}></xsl:#{I}>"].K~N,'"&~VbLf~&"'}":s="~~~":For~i=0To~7:s~&=Chr(32-(Asc(c)>>7-i~And~1)*23):Next:#$C(s~&n~&Chr(9)&n~&"~~"):Next:#$C(n~&n~&n):
End~Sub:End~Module)]}`nput=s`nZ`nqa`x21",3){%($H("%s",#$S);)+N}}end~endmodule)],?%]+R}}"]},i=0,t='k';while(s[i])t='^x60.'+s[i++]+t;console.log(t)",B],?`x21].K(?',%('"'"'))}'"^n::=^na")],/[`[`]$]/]}")]};Z"0~0~-1";)],?']}';cr",127..255];
f(%(variable~s=`x60#{s.K(/.{1,234}/){$&.K("`x60",%(`x60+"`x60"+`x60))+"`x60+`n`x60"}}`x60,i;for(i=0;i<129;i++)s=strreplace(s,pack("C",255-i),substrbytes(`x60#{v[0,99]}`x60+`n`x60#{v[99..-1]}`x60,i*2+1,2));Zf("%s",s)),7){"f('%s')`n"%$s.
unpack("`x48*")}}Zf("^n#[Exeunt]");quit)]}")),196){%(Z#$S;)}}}"]});})).gsub(/[!HJKXYZ^`~]/){[B*2,:write,B,:tring,:gsub,"ain()",B*4,:print,g,:in][$&.ord%47%12]})))*"")#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_
############################################################################## Quine Relay -- Copyright (c) 2013, 2014 Yusuke Endoh (@mametter), @hirekoke #############################################################################)
Demo:
https://travis-ci.org/mame/quine-relay
Quine-relay
• A Ruby code
• that generates Rust code
• that generates Scala code
• …
• that generates REXX code
• that generates the original Ruby code
128 languages
involved
in total
Quine-relay
• A Ruby code
• that generates Rust code
• that generates Scala code
• …
• that generates REXX code
• that generates the original Ruby code
128 languages
involved
in total
Spoiler: Quine-relay
eval s=%q(
s=%(eval s=%q(#{s}))
# Generate a REXX code that prints it
# …
# Generate a Scala code that prints it
# Generate a Rust code that prints it
puts s
)
Monumental Quine
A column object 3D model data
Ruby code
is inscribed
You can buy it at Shapeways!
https://www.shapeways.com/shops/mametter
Execute
the code
3D
printer
Spoiler: Monumental Quine
eval s=%q(
s=%(eval s=%q(#{s}))
# Generate 3D model data that
# embeds the string
puts s
)
+TrueType font data
+Font renderer
+Code golf
Radiation-hardened Quine
eval=eval=eval='eval$s=%q(eval(%w(puts((%q(eval=ev
al=eval=^Z^##^_/#{eval@eval@if@eval)+?@*10+%(.size
>#{(s=%(eval$s=%q(#$s)#)).size-1}}}#LMNOPQRS_##thx
.flagitious!## )+?@*12+%(TUVW XY/.i@rescue##
/_3141592653 589793+)+?@* 16+%(+271828
182845904; _987654321 0;;eval)+?
@*18+%("x =((#{s.s um}-eval.
_sum)%256 ).chr; ;eval)+?@
*12+%(.s can(//){ a=$`+x+$
^_a.unpa ck (^ H*^)[0].
hex%999989==#{s.unpac k("H*")[0].hex%999989
}&&eval(a)}#"##"_eval @eval####@(C)@Copyrig
ht@2014@Yusuke@Endoh@# ###)).tr("@_^",32.chr<
<10<<39).sub(?Z,s));e xit#AB CDEFGHIJK)*%()))#'##'
/#{eval eval if eval .size>692}}#LMNOPQRS
##thx.flagitious!## TUVWXY/.i rescue##/
3141592653589793+ +271828182845904;
9876543210;;eval "x=((42737-eval.
sum)%256).chr;;eval .scan(//){a=$`+x+$'
a.unpack('H*')[0].hex%999989==68042&&eval(a)}#"##"
eval eval#### (C) Copyright 2014 Yusuke Endoh ####
Demo
• Works as an ordinary Quine
$ ruby rquine.rb > rquine2.rb
$ diff –s rquine.rb rquine2.rb
rquine.rb and rquine2.rb are identical
Radiation deletes any one letter...
eval=eval=eval='eval$s=%q(eval(%w(puts((%q(eval=ev
al=eval=^Z^##^_/#{eval@eval@if@eval)+?@*10+%(.size
>#{(s=%(eval$s=%q(#$s)#)).size-1}}}#LMNOPQRS_##thx
.flagitious!## )+?@*12+%(TUVW XY/.i@escue##
/_3141592653 589793+)+?@* 16+%(+271828
182845904; _987654321 0;;eval)+?
@*18+%("x =((#{s.s um}-eval.
_sum)%256 ).chr; ;eval)+?@
*12+%(.s can(//){ a=$`+x+$
^_a.unpa ck (^ H*^)[0].
hex%999989==#{s.unpac k("H*")[0].hex%999989
}&&eval(a)}#"##"_eval @eval####@(C)@Copyrig
ht@2014@Yusuke@Endoh@# ###)).tr("@_^",32.chr<
<10<<39).sub(?Z,s));e xit#AB CDEFGHIJK)*%()))#'##'
/#{eval eval if eval .size>692}}#LMNOPQRS
##thx.flagitious!## TUVWXY/.i rescue##/
3141592653589793+ +271828182845904;
9876543210;;eval "x=((42737-eval.
sum)%256).chr;;eval .scan(//){a=$`+x+$'
a.unpack('H*')[0].hex%999989==68042&&eval(a)}#"##"
eval eval#### (C) Copyright 2014 Yusuke Endoh ####
r
Demo
• You can delete any one character
• It automatically restore itself!
$ ruby broken.rb > rquine2.rb
$ diff –s rquine.rb rquine2.rb
rquine.rb and rquine2.rb are identical
Spoiler: Radiation-hardened Quine
• Redundancy-based error-correction
– The longer one is always not broken
• When a letter out of "<YOUR CODE>" is
deleted, what should we do?
x = "<YOUR CODE>"
y = "<YOUR CODE>"
eval [x, y].max_by {|s| s.size }
Spoiler: Radiation-hardened Quine
• A style against one-letter deletion
• Even if one letter is deleted, this code
successfully does one of the following:
– Assign the string like "<YOUR CODE>" to a
variable eval
– Call eval to "<YOUR CODE>" and exit
• Note: Cookpad's service is robust, but its
source code is not so bad like this
x = "<YOUR CODE>"
eval=eval=eval="(<YOUR CODE>;exit)#"##"
rewrite
More? Buy my book!
• "The World of
Obfuscated,
Esoteric, Artistic
Programming"
– Contains about 40
codes like this talk
– Written in Japanese
Related work
• International Obfuscated C Code Contest
(IOCCC)
– A programming contest for hard-to-read
programs written in C language
• Transcendental Ruby Imbroglio Contest
for rubyKaigi (TRICK)
– The judges (including I) held TRICK twice
• https://github.com/tric/trick2013
• https://github.com/tric/trick2015
– TRICK FINAL will be held in RubyKaigi 2018
• Please send your esoteric Ruby code to us!
• https://github.com/tric/trick2018
Conclusion
• Ruby is very rich and flexible language
– You can use Ruby with broken keyboards
(only symbols, or only alphabets)
– You can write artistic and super-robust
Quine in Ruby
• One more thing…
A Quine that takes five minutes
0;BEGIN{eval(s=%q~s=s.gsub(/¥e¥[¥d+m/,"");eval((%w¥C="0;BEGIN{eval(s=%q#{126.chr+s+126.chr})}";E=""
;Z=32.chr;D=->k,d{c=35;k.scan(/../){c+=1;d.gsub!(c.chr,$&)};d};include(Math);M=D["PPQPQi^heigMk=nis
iJO^L^MjQqiEPQjQn^ikjviKNfihhvLFPOLQOPQoiOijd]igiljkMmihjkiQQNNiQiPjiiilihi","^kNojsdhm.;vA.;/7ciqL
^A;;.vA5k&jjBhohdvPkhd^lNQE(m3:v0:vjlHkhdjGhHN:HjOHj6Bim1HBgn*-INBinJPNvdjnBfnPO3gGhkO%NBhn>INvdlnB
cl@lkldclJij7jjBjm(:PHqdcnBjoN@eLNHOehI+H4hFE3h>H3h+92rhD92jhGbi6Orh?i0oh>H4hQG2f&GHOohJi0rhPD6P'QD
EIv&92'I_K/8P8Q8P818Q8QK,9D1NQNDKKK1KQNGK8DKKKG)QciDkA@9^,G^AmM;Q@/?;OI^=P7FQ/?vM?.%vM?.,9bL%;OI5lh
`,_CI]A]LCGCDCNC@C]MCNCNC5CG]L]ACkk]PD*PF&h6Omhgj<P*?:HOmhgjkArM><'6Pgh6OJ$I)Q:2fhgjP<<(IlhE4hfj$<J
?ihH4hHPI)J$I'2f3<</IghEIgHha@D@N_Bjmm0]35khP?@n0]h]HvOjJ?qLOJ>F7gL>%Jo=@eM<-mLOJ>-mLOfMGoM>7fM(rA5
kAkOdjm7`9)fM5G+IsMf=4L1GgL4if=G+:_D*-I^$-J•i]"].bytes;F=44100;z={};H=->n,l,v{z[[n,l,v]]||=(l=(3e5/
l).round;t=0.0;(0...l).map{|j|k=(j+1000)%l/1000.0;x=j*440*2**(n/12.0)/F*PI;sin(x+2*t=sin(x+t))*v*(k
>4?1:(2-(3-k).abs).abs)/3})};W="MHJEFAFH".bytes.flat_map{|n|H[n-84,6,30]}*29+H[-7,3,30];i=n=v=0;l=6
;(c=M.pop-98;c<0?v=c*5+55:(l=l*12/(2**(c%5)*3**(c/5));d=M.pop-93;d>0&&(j=i;H[n+=d-13,l,v].map{|t|W[
j]+=t;W[j+4e5]+=t;W[ j+8e5]+=t;j+ =1 }); i+ =3e 5/l)) while
(M!=[]);Y=["data",W. size,*W.map{ | n|n +1 28} ].pa c k("A4VC
*");o=IO.popen("apla y"+Z+"-q"+Z+?-, " wb" ); o<<["R IFF",28+Y
.size,"WAVEfmt"+Z,16 ,1,1,F,F,1, 8]. pac k( "A4V A8VvvVVvv
")<<Y.slice!(0,4410 0 *3);L=D["*1 /< 7q 8j 9B 9aA3H CHIH aJ|k@|>EI
GAIJIaiaDDFFFkaq j J ff EJjja|qqEa Gb ppJa H H| |kkbbI IJJaa","J
gGG2i66,Cg2C2i3 ;& Jd e Hde,;Cj&D+A-$?,C;H<=I?DHJA-$@@=F@@kEka8?a<1@=8q=8qa&>=?4A4
$=a @?J@ <<= %? I=a1|f 'a =%EGJAii2c3;7:;JqF@;J?ka?/;Cq7:?'?'a?%<GC2cDI7=6D4iB-lliH4
iCg +i.C5pCB555pCBI): B5ipaB>nm|hh >j):0> j)jB q 4o J:0
c:q| .B>.(0>.( pI> JqB0 (j|+`hhc6J "]. tr (" a -z"
,Z+" #'()+,-./ =@ MTV_" <<92);P=- >s{[q="+ ---+"+ Z *(6 + s.size),"
|:#{s }:SPONS OR S",q]} ;f=40;c= E+R=D["4 =8]?:B . B@C / C<<7_?
<5<8]?66 _9A8;;==BC]_ _:_C??B`> >]A @@ AAB B CC__``]]"
,"$AC-8<C ]: $2 - > <:4@. -1`$]8-1C_` 4)5-7C 74C? 5A5 , 574C9B=C]
99`=<<?5219?(C(2<9C2 19?B86/)'1&_06/)'1&_006(2<9.,:>A_<_<_@<<?'3333;7CA7@6@3
>:CA,`*C%;>7+2%>A:+2 %:A7<,`*C8++@6&*_"];S=[[["EXECUTIVE:ADMINISTRATOR","Abb
y:Phoenix"],["EVENT: PRODUCE R ","Hea ther :Johnson" ],["S
PONSORSHIP:CONSULTAN T","Shirley:B ai les "] ,],[[(t= "PR OGR
AM:")+"CHAIR","Sarah :Mei"],[t+="DIRECTOR" ,"E va n:Phoe n ix"],[t, "Ma rty
:Haught"],],[[t="TRA CKDIRECTOR","Akira:Matsuda"] ,[t ," Corali n e:Ada:Eh mke
"],[t,"Courteney:Ervin"],],[[t,"Derek:Prior"],[t,"N adi a:O du nayo"],[ t," Nic
kolas:Means"],]].map{|a|a.flat_map{|x,y|[E]*5+[x+Z* x.s ize,Z *y.s i ze+ y]}
[5..-1]};S[1,0]=[p,"[[:Program:Committee:]]"];[p,C.gsub(/./){Z==$&?c.slice!(0,1).tr("]_`","##;"):Z}
.lines[11,24],p,'<<-"RubyConf:2017":--:@New_Orleans.->>',p,"[[:Planning:Team:]]",*S,p,P["DIAMOND"],
p,L.scan(/.{92}/)[0,7],p,P["PLATINUM"],p,L[7*92..-1].scan(/.{47}/),p,P["GOLD"],*[["STITCH:FIX","sqr
een"],["Braintree","HEROKU"],["entelo","SENTRY"],["DATADOG","ROOSTIFY"]].map{|a|f=40-f;a.flat_map{|
s|l=Z*f;r=Z*f=40-f;[E,E,l+s+r,l+?=*s.size+r,E,E]}},p,P["BRONZE"]+[E,"BRAKEMANPRO"]+[E]*4+P["OTHER"]
+[E,"covermymeds",E,"Google:Cloud:Platform"],p,"Brought:to:you:by:the:folks:at:Ruby:Central",p,"Rub
yConf:2017",p,[?%*39,u="%%"+Z*35+"%%","%%::::Remember!::This:is:a:Quine!::::%%",u,"%%:This:banner:i
s:a:valid:Ruby:code.:%%",u,?%*39,],p,["The:original:source:code:follows...",E,E,"---8<---"*8],p,C.g
sub(/./){Z==$&?(c=R.slice!(0,1).ord;27.chr+"[#{c-52}m#{Z}"+27.chr+"[0m"):$&}.lines].flat_map{|s|(s)
?(s=[*s];s.map{|l|l.center(99).rstrip}+[E]*[0,(24-s.size)/2].max+[p]):[E]*24}.map{|s|n=(s)?(puts(Z=
=s[0]?s.tr(?:,Z):s);1):92;t=Time.new;o<<Y.slice!(0,4410*n);$$until(t+0.09*n<Time.now)};o<<Y;o.close
;exit;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;¥*"").gsub(/¥e¥[¥d+m/,""))~)}
Demo:
https://www.youtube.com/watch?v=ABuj0XfltpM

Más contenido relacionado

Destacado

Can We Prevent Use-after-free Attacks?
Can We Prevent Use-after-free Attacks?Can We Prevent Use-after-free Attacks?
Can We Prevent Use-after-free Attacks?inaz2
 
Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTokuhiro Matsuno
 
やさしいGemパッチの作り方
やさしいGemパッチの作り方やさしいGemパッチの作り方
やさしいGemパッチの作り方Maki Toshio
 
Quine・難解プログラミングについて
Quine・難解プログラミングについてQuine・難解プログラミングについて
Quine・難解プログラミングについてmametter
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHiroshi SHIBATA
 
How to build LibreOffice on your desktop
How to build LibreOffice on your desktopHow to build LibreOffice on your desktop
How to build LibreOffice on your desktopMasataka Kondo
 
Write your story with open source
Write your story with open source Write your story with open source
Write your story with open source Umul Sidikoh
 
Cookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
Cookpad 17 day Tech internship 2017 言語処理系入門 RubyをコンパイルしようCookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
Cookpad 17 day Tech internship 2017 言語処理系入門 RubyをコンパイルしようKoichi Sasada
 
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考えるGoのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考えるpospome
 
LibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl CultureLibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl CultureNaruhiko Ogasawara
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage SystemsSATOSHI TAGOMORI
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd SeasonSATOSHI TAGOMORI
 

Destacado (13)

Can We Prevent Use-after-free Attacks?
Can We Prevent Use-after-free Attacks?Can We Prevent Use-after-free Attacks?
Can We Prevent Use-after-free Attacks?
 
RSpec Performance Turning
RSpec Performance TurningRSpec Performance Turning
RSpec Performance Turning
 
Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and Testing
 
やさしいGemパッチの作り方
やさしいGemパッチの作り方やさしいGemパッチの作り方
やさしいGemパッチの作り方
 
Quine・難解プログラミングについて
Quine・難解プログラミングについてQuine・難解プログラミングについて
Quine・難解プログラミングについて
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
How to build LibreOffice on your desktop
How to build LibreOffice on your desktopHow to build LibreOffice on your desktop
How to build LibreOffice on your desktop
 
Write your story with open source
Write your story with open source Write your story with open source
Write your story with open source
 
Cookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
Cookpad 17 day Tech internship 2017 言語処理系入門 RubyをコンパイルしようCookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
Cookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
 
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考えるGoのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
 
LibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl CultureLibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl Culture
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd Season
 

Similar a Esoteric, Obfuscated, Artistic Programming in Ruby

Esoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in RubyEsoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in Rubymametter
 
Testing web APIs
Testing web APIsTesting web APIs
Testing web APIsFDConf
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Dockertoffermann
 
Linux System Administration
Linux System AdministrationLinux System Administration
Linux System AdministrationJayant Dalvi
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsPuppet
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversBrian Gesiak
 
Boxen: How to Manage an Army of Laptops and Live to Talk About It
Boxen: How to Manage an Army of Laptops and Live to Talk About ItBoxen: How to Manage an Army of Laptops and Live to Talk About It
Boxen: How to Manage an Army of Laptops and Live to Talk About ItPuppet
 
Licão 12 decision loops - statement iteration
Licão 12 decision loops - statement iterationLicão 12 decision loops - statement iteration
Licão 12 decision loops - statement iterationAcácio Oliveira
 
IntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptxIntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptxchrisdy932
 
Rubinius - A Tool of the Future
Rubinius - A Tool of the FutureRubinius - A Tool of the Future
Rubinius - A Tool of the Futureevanphx
 
Blocks by Lachs Cox
Blocks by Lachs CoxBlocks by Lachs Cox
Blocks by Lachs Coxlachie
 
Bugs found in GCC with the help of PVS-Studio
Bugs found in GCC with the help of PVS-StudioBugs found in GCC with the help of PVS-Studio
Bugs found in GCC with the help of PVS-StudioPVS-Studio
 
TechDays - IronRuby
TechDays - IronRubyTechDays - IronRuby
TechDays - IronRubyBen Hall
 
Applying RSpec Best Practises
Applying RSpec Best PractisesApplying RSpec Best Practises
Applying RSpec Best PractisesNeil Henegan
 
Ruby for .NET developers
Ruby for .NET developersRuby for .NET developers
Ruby for .NET developersMax Titov
 

Similar a Esoteric, Obfuscated, Artistic Programming in Ruby (20)

Esoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in RubyEsoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in Ruby
 
TypeScript Go(es) Embedded
TypeScript Go(es) EmbeddedTypeScript Go(es) Embedded
TypeScript Go(es) Embedded
 
Testing web APIs
Testing web APIsTesting web APIs
Testing web APIs
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
Linux System Administration
Linux System AdministrationLinux System Administration
Linux System Administration
 
Cucumbered
CucumberedCucumbered
Cucumbered
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of Laptops
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the Covers
 
Boxen: How to Manage an Army of Laptops and Live to Talk About It
Boxen: How to Manage an Army of Laptops and Live to Talk About ItBoxen: How to Manage an Army of Laptops and Live to Talk About It
Boxen: How to Manage an Army of Laptops and Live to Talk About It
 
Licão 12 decision loops - statement iteration
Licão 12 decision loops - statement iterationLicão 12 decision loops - statement iteration
Licão 12 decision loops - statement iteration
 
IntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptxIntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptx
 
Rubinius - A Tool of the Future
Rubinius - A Tool of the FutureRubinius - A Tool of the Future
Rubinius - A Tool of the Future
 
2-Functions.pdf
2-Functions.pdf2-Functions.pdf
2-Functions.pdf
 
Blocks by Lachs Cox
Blocks by Lachs CoxBlocks by Lachs Cox
Blocks by Lachs Cox
 
Bugs found in GCC with the help of PVS-Studio
Bugs found in GCC with the help of PVS-StudioBugs found in GCC with the help of PVS-Studio
Bugs found in GCC with the help of PVS-Studio
 
Meet ruby
Meet rubyMeet ruby
Meet ruby
 
TechDays - IronRuby
TechDays - IronRubyTechDays - IronRuby
TechDays - IronRuby
 
Simple perl scripts
Simple perl scriptsSimple perl scripts
Simple perl scripts
 
Applying RSpec Best Practises
Applying RSpec Best PractisesApplying RSpec Best Practises
Applying RSpec Best Practises
 
Ruby for .NET developers
Ruby for .NET developersRuby for .NET developers
Ruby for .NET developers
 

Más de 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
 

Más de 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
 

Último

Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...First NO1 World Amil baba in Faisalabad
 
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil Baba Company
 
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts ServiceVip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts ServiceApsara Of India
 
Vip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services AvailableVip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services AvailableKomal Khan
 
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...Amil Baba Company
 
Low Rate Call Girls In Budh Vihar, Call Us :-9711106444
Low Rate Call Girls In Budh Vihar, Call Us :-9711106444Low Rate Call Girls In Budh Vihar, Call Us :-9711106444
Low Rate Call Girls In Budh Vihar, Call Us :-9711106444CallGirlsInSouthDelh1
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceTina Ji
 
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证gwhohjj
 
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort ServicesHi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort ServicesApsara Of India
 
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba Company
 
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa EscortsCash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa EscortsApsara Of India
 
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书zdzoqco
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxsayemalkadripial4
 
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full NightCall Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170Sonam Pathan
 
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCRdollysharma2066
 
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一lvtagr7
 
Call Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call GirlsCall Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call Girlsssuser7cb4ff
 

Último (20)

Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
 
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
Amil baba in Pakistan amil baba Karachi amil baba in pakistan amil baba in la...
 
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts ServiceVip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
Vip Udaipur Call Girls 9602870969 Dabok Airport Udaipur Escorts Service
 
Vip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services AvailableVip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services Available
 
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
 
Low Rate Call Girls In Budh Vihar, Call Us :-9711106444
Low Rate Call Girls In Budh Vihar, Call Us :-9711106444Low Rate Call Girls In Budh Vihar, Call Us :-9711106444
Low Rate Call Girls In Budh Vihar, Call Us :-9711106444
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
 
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
 
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort ServicesHi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
Hi Class Call Girls In Goa 7028418221 Call Girls In Anjuna Beach Escort Services
 
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
 
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa EscortsCash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
Cash Payment Contact:- 7028418221 Goa Call Girls Service North Goa Escorts
 
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptx
 
Call Girls Koti 7001305949 all area service COD available Any Time
Call Girls Koti 7001305949 all area service COD available Any TimeCall Girls Koti 7001305949 all area service COD available Any Time
Call Girls Koti 7001305949 all area service COD available Any Time
 
Environment Handling Presentation by Likhon Ahmed.pptx
Environment Handling Presentation by Likhon Ahmed.pptxEnvironment Handling Presentation by Likhon Ahmed.pptx
Environment Handling Presentation by Likhon Ahmed.pptx
 
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full NightCall Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
 
Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170Call Girls Near The Corus Hotel New Delhi 9873777170
Call Girls Near The Corus Hotel New Delhi 9873777170
 
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
 
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
 
Call Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call GirlsCall Girls Ellis Bridge 7397865700 Independent Call Girls
Call Girls Ellis Bridge 7397865700 Independent Call Girls
 

Esoteric, Obfuscated, Artistic Programming in Ruby

  • 1. Esoteric, Obfuscated, Artistic Programming in Ruby Yusuke Endoh (@mametter) Cookpad Inc. RubyConf 2017 (2017/11/17)
  • 2. Yusuke Endoh (@mametter) • MRI committer • @ Cookpad Inc. – w/ @ko1 – Ko1: performance improvement – me: "Make Ruby programs robust"
  • 3. My contributions for Ruby • The release manager for 2.0 • Implemented coverage.so, keyword arguments, etc. • OptCarrot: A NES emulator for Ruby3x3 benchmark • Branch coverage (Ruby 2.5) ↑OptCarrot . https://eregon.me/blog/2016/11/28/optcarrot.html http://engineering.appfolio.com/appfolio-engineering/2017/9/22/optcarrot-an-excellent-cpu-benchmark-for-ruby-3x3
  • 4. Today's Topic: Ruby's power • "Ruby is easy to read and write"? – Incorrect • Ruby is just rich and flexible – Easy to write an easy-to-read code – Also, easy to write a hard-to-read code • I show you my bad examples – (Note: I'll talk about nothing useful)
  • 5. Can you read? @_="_"=~/$/;_=@_+@_;$><<(""<<(_*_*_+@_)*_*_*_<< ((_+@_)*_*_*_+@_)*_*_+@_<<(((_+@_)*_*_+@_)*_+@_ )*_ *_ << ( ( (_+@_ )*_*_+ @_) * _+ + @_) * _*_ <<((((+ _+@_)*_ * _+ + +@_ )*_+@_)* _++ @_ )* _ ++@_ <<((_*_+@_ )*_ + + + @_)* _*_ <<_*_*_*_* _<< ( (_ * _ +@_) *_*_*_++@_ )*_<<(((_++@_)*_+@_)*_*_+@_)*_*_+@_<<((_+@_)*_* _*_*_ +@_)* _<<( ( (_+ +@_ )*_ ++ @_ ) *_+ @_) *_*_*_+ @_<< ( _* _ *_*_*_++ @_) *_+@_<< (((( _ ++ + +@_)* _*_ ++ @_ )* _ +@_)*_++ @_)*_ +@_<< (((( _+ + @_)*_*_+ @_)*_+@_)*_+@_)*_<<(((_+@_)*_*_*_+@_)*_+@_)*_<< _*_*_*_*_+@_<<(_*_+@_)*_)#_$`/^|:()[_-|?|_||:`/
  • 6. Can you read? @_="_"=~/$/;_=@_+@_;$><<(""<<(_*_*_+@_)*_*_*_<< ((_+@_)*_*_*_+@_)*_*_+@_<<(((_+@_)*_*_+@_)*_+@_ )*_ *_ << ( ( (_+@_ )*_*_+ @_) * _+ + @_) * _*_ <<((((+ _+@_)*_ * _+ + +@_ )*_+@_)* _++ @_ )* _ ++@_ <<((_*_+@_ )*_ + + + @_)* _*_ <<_*_*_*_* _<< ( (_ * _ +@_) *_*_*_++@_ )*_<<(((_++@_)*_+@_)*_*_+@_)*_*_+@_<<((_+@_)*_* _*_*_ +@_)* _<<( ( (_+ +@_ )*_ ++ @_ ) *_+ @_) *_*_*_+ @_<< ( _* _ *_*_*_++ @_) *_+@_<< (((( _ ++ + +@_)* _*_ ++ @_ )* _ +@_)*_++ @_)*_ +@_<< (((( _+ + @_)*_*_+ @_)*_+@_)*_+@_)*_<<(((_+@_)*_*_*_+@_)*_+@_)*_<< _*_*_*_*_+@_<<(_*_+@_)*_)#_$`/^|:()[_-|?|_||:`/
  • 7. Demo • "Hello, RubyConf!" program written using only symbol characters $ ruby symbols.rb Hello, RubyConf! $
  • 8. Spoiler • If you want to read it yourself… • Three key techniques – How to make a number (by only symbols) – How to make a string (by only symbols) – How to print a string (by only symbols)
  • 9. Spoiler: How to make a number • String#=~ returns the beginning index of matched substring • Calculation to make a large number "Hello, RubyConf!" by Symbols "@" =~ /$/ #=> 1 "@@" =~ /$/ #=> 2 "@@@" =~ /$/ #=> 3 _ = ("@@"=~/$/) # assigns 2 to _ _*_*_*_ #=> 16
  • 10. Spoiler: How to make a string • String#<< treats an integer as a codepoint (ASCII code) "Hello, RubyConf!" by Symbols "" << 72 << 101 << 108 << 108 << 111 #=> "Hello"
  • 11. Spoiler: How to print a string • $> is $stdout • IO#<< writes its argument to the IO "Hello, RubyConf!" by Symbols $> << "Hello"
  • 12. Spoiler: Use All Techniques $> << "Hi" $> << ("" << 72 << 105) __ = "_"=~/$/ _ = "__"=~/$/ $> << ("" << (_*_*_+__)*_*_*_ << ((_+__)*_*_+__)*_*_*_+__) 1 2 72 105 "Hello, RubyConf!" by Symbols
  • 13. Spoiler: More Complex Code? • Q. Can we write a more complex code than "Hello, world!"? • A. Yes! There is a great idiom to call "eval" by using only symbols • Exercise: Explain how it works ->(&_){ _["", "eval", "<YOUR RUBY CODE>"] }[&:"#{ "send" }"] "Hello, RubyConf!" by Symbols Replace them by using the previous techniques
  • 14. Question 2: Can you read? 90-line code by only alphabets! begin begin begin public begin begin def each clear rescue begin begin begin end end end concat begin dup ensure concat begin clear concat concat concat concat concat concat size concat begin begin begin size end end end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear begin concat concat size end until hex concat concat concat concat begin size end concat concat begin size end rescue upcase begin concat begin concat size end end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat begin concat size end unless begin end begin concat concat concat begin size end end begin begin concat concat size end end concat begin concat begin size end end concat concat begin size end unless begin end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat concat begin begin size end end concat concat concat size unless begin end concat begin concat size end if downcase begin concat concat size end rescue upcase concat begin concat size end unless begin end concat begin begin begin size end end end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat concat concat concat concat concat size begin concat concat size end rescue upcase concat size if downcase rescue upcase begin size end ensure begin clear end end end concat begin dup ensure concat begin clear begin concat concat begin size end end begin concat concat size end unless begin end concat concat begin begin size end end concat concat begin concat concat size end begin begin concat size end end if downcase begin size end ensure begin clear end end end concat begin dup ensure concat begin clear begin concat begin concat size end end concat concat concat concat concat size begin concat concat size end rescue upcase begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat concat begin size end if downcase begin begin concat concat size end end concat concat concat size rescue upcase concat concat concat size rescue upcase begin concat begin size end end rescue upcase begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat concat concat size rescue upcase concat concat concat begin concat size end concat begin concat begin size end end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat concat concat concat concat concat size begin size end ensure begin clear end end end concat begin dup ensure concat begin clear begin concat begin concat concat size end end concat concat begin size end unless begin end concat concat concat size unless begin end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat concat begin size end rescue upcase begin begin concat concat concat size end end concat begin concat size end unless begin end concat begin concat begin size end end begin begin concat concat size end end begin begin concat size end end rescue upcase begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat begin concat size end rescue upcase concat begin concat begin concat size end end begin concat concat size end unless begin end concat concat begin begin concat size end end begin size end ensure begin clear end end end begin begin prepend begin chr end end end concat begin dup ensure concat begin clear begin concat concat begin size end end concat begin concat concat concat size end begin concat concat concat begin size end end begin concat begin size end end if downcase begin size end ensure begin clear end end end puts concat begin dup ensure concat begin clear concat begin concat concat concat size end concat begin concat concat concat size end size ensure clear end end end end end end for each in begin inspect end do end end end begin begin begin public begin begin def each clear rescue begin begin begin end end end concat begin dup ensure concat begin clear concat concat concat concat concat concat size concat begin begin begin size end end end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear begin concat concat size end until hex concat concat concat concat begin size end concat concat begin size end rescue upcase begin concat begin concat size end end begin size end ensure begin clear end end end concat begin dup ensure concat begin clear concat begin concat size end unless begin end
  • 15. Demo • "Hello, RubyConf!" program written using only alphabets $ ruby alphabets.rb Hello, RubyConf! $
  • 16. Spoiler: Basic Structure "Hello, RubyConf!" by Alphabets s = inspect #=> "main" s.clear s.concat 72 #=> add 'H' s.concat 105 #=> add 'i' puts s Need to remove the periods
  • 17. class String def foo self.clear self.concat 72 #=> add 'H' self.concat 105 #=> add 'i' puts self end end inspect.foo Spoiler: Abuse Open Class "Hello, RubyConf!" by Alphabets We can omit "self." ! Need to remove the period
  • 18. class String def each clear concat 72 #=> add 'H' concat 105 #=> add 'i' puts self end end for x in inspect do end Spoiler: Abuse "for"-statement "Hello, RubyConf!" by Alphabets Equivalent to inspect.each {} Exercise: Remove the numbers and the upper-case letter Got "Hi" program By only alnums!
  • 19. Frequently Asked Question • Q. Why do I write such a program? • A. Because it's there. – To figure out Ruby's power and its limit – To stress the interpreter with unusual code • Q. What inspired me? • A. Esoteric programming languages – Funny joke languages including Brainf*ck and Chef
  • 20. Brainf*ck • A language using only eight symbols – Inspired me to create "Hello by Symbols" +++++++++[>++++++++>+++++++++++>+++++<<< ]>.>++.+++++++..+++. >-.------------.<++ ++++++.---- ----.+++.------.--------.>+. Hello, world! in Brainf*ck Examples of Esolangs
  • 21. Chef (not a provisioning tool) • A language where programs look like cooking recipes Cheese cake in Chef. Ingredients. 100 g cream cheese 97 g sour cream *snip* Method. Put the cream cheese into the mixing bowl. Put the sour cream into the mixing bowl. *snip* Examples of Esolangs Data section Code section
  • 22. [PR] Cookpad • One of the world's largest recipe sharing platform • My Cheesecake recipe is published at Cookpad – https://cookpad.com/us/ recipes/3335222 – It is a program in Chef • Prints "cookpad" – It can be also used as a real recipe • Chef (and some esolangs) inspired me to create a funny-shaped Ruby code…
  • 23. Can you read? 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
  • 24. Demo $ cat qlobe.rb 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 $ ruby qlobe.rb v=0473;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 $ ruby qlobe.rb|ruby 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 $ ruby qlobe.rb|ruby|ruby 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 $ ruby qlobe.rb|ruby|ruby|ruby 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 $ ruby qlobe.rb|ruby|ruby|ruby|ruby 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 $ ruby qlobe.rb|ruby|ruby|ruby|ruby| 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 $ ruby qlobe.rb|ruby|ruby|ruby|ruby| 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 $ ruby qlobe.rb|ruby|ruby|ruby|ruby| 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
  • 25. Qlobe: A Quine with Spinning Globe 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=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=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=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=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=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=0473;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 0° 45°W 90°W 135°W 180° 135°E 90°E 45°E
  • 26. Spoiler: Two key techniques • Quine: self-reproducing program • ASCII-art programs – Ruby's %-notation works great for them
  • 27. Spoiler: Quine • A program that prints its source code • Basic structure eval s=%q( s="eval s=%q(#{s})" # Do funny thing here! # e.g., Rotate the globe in the string puts s ) Qlobe: A Quine with Spinning Globe Reconstruct the original code as a string Print it
  • 28. Spoiler: ASCII-art code • Write a code with no space and backslash • Wrap it with "eval(%w(" and ").join)" • You can shape your code as you like puts"Hello,world!" eval(%w(puts"Hello,world!").join) eval(%w(pu ls "H el lo ,w or ld!")*"")# #=> Hello,world!
  • 29. Quine-relay eval$s=%q(eval(%w(B=92.chr;g=32.chr;puts(eval(%q(N=10.chr;n=0;e=->s{Q[Q[s,B],?"].K(N,B+?n)};E=->s{'("'+e[s]+'")'};d=->s,t=?"{s.K(t){t+t}};def~f(s,n)s.K(/.{1,#{n*255}}/m){yield$S=E[$s=$&]}end;Q=->s,t=?${s.K(t){B+$&}};R=";return~0;";V=-> s,a,z{s.K(/(#{B*4})+/){a+"#{$&.size/2}"+z}};C=%w(System.Console~Write);$C=C*?.;$D="program~QR";$G="~contents~of"+$F="~the~mix!g~bowl";$L="public~static";rp=->s,r{v="";[r.!ject(s){|s,j|o={};m=n=0;s.size.times{|i|o[f=s[i,2]]||=0;c=o[f]+= 1;m<c&&(m=c;n=f)};v=n+v;s.K(n,(j%256).chr)},v]};%(fn~mX{Z`x21("{}",#{E["object~QR~extends~App{#{f(%((display~"#{e[%(Zf("1d;s/.//;s/1/~the~sum~of~a~son~and0/g;s/0/~twice/g;s/2/`x59ou~are~as~bad~as/g;s/3/~a~son`x21Speak~your~m!d`x21/g^n# The~Relay~of~Qu!e.^n#Ajax,~a~man.^n#Ford,~a~man.^n#Act~i:~Qu!e.^n#Scene~i:~Relay.^n#[Enter~Ajax~and~Ford]^n#Ajax:^n#");function[]=f(s);for~i=1:2:length(s),Zf("2%s3",part(dec2b!(hex2dec(part(s,i:i+1))),$:-1:2)),end;endfunction`n#{s,v=rp ["Transcript~show:~'#{d["Z"+E[%(fun~p~n=Z(Int.toSJ~n`x5e"~");p~0;p~0;p~130;List.tabulate(127,p);SJ.map(fn~c=>(p(3+ord~c);Z"-1~0~";c))#{E[%(puts~"#{Q[e[%(echo~'a::=`x7e#{Q[Q["let~s=#{E["!t~mX{Z#{d[E[%(module~QR;!itial~beg!~#{f("let~s=#{ E[%(Module~QR:Sub~MX:Dim~s,n,i,c~As~Object:n=Chr(10):For~Each~c~!"#{d["<?xml#{O="~version='1.0'"}?><?xml-#{I="stylesheet"}~type='text/xsl'href='QR.xslt'?><xsl:#{I+O}~xmlns:xsl='http://www.w3.org/1999/`x58SL/Transform'><xsl:output~metho d='text'/><#{U="xsl:template"}~match='/'><`x21[CDATA[#{%(sub~f(s$,n)Z(s$);:for~i=1to~n~Z("Y");:next:end~sub:f("#{V[e[%(H,format="#{y="";f("^H{-}{txt}{#{Q["echo~-E~$'#{Q[Q[E[%(with~Ada.Text_Io;procedure~qr~is~beg!~Ada.Text_Io.Put("#{d[% (!terp:library"afnix-sio"`ntrans~O(n){trans~o(afnix:sio:OutputTerm)`no:H(Byte(+~128~n))}`ntrans~f(v~n){`nO(+(/~n~64)107)`nO(n:mod~64)`nO~v}`ntrans~D(n){if(<~n~4){f(+(*~6~n)9)48}{if(n:odd-p){D(-~n~3)`nf~27~48`nf~36~11}{D(/~n~2)`nf~21~48 `nf~48~20}}}`ntrans~S"#{e[%W[STRINGz:=~226+~153,a:=z+~16 6,b:=a+"2 "+z+~160,c:=b+"8"+z+~165,t:="#!clude<iostream>"+~(10)+"!t"+~(32)+"mX{puts#{d[E[%(class~QR{#$L~void~ma!(SJ[]v){System.out.Z(#{E["H('#{Q[e["implement~ma!0()=Z"+E["BEGIN{ Z#{E[%(echo~'#{%(f(s){System.out.Z(s);}s="389 **6+44 *6+0 0p45*,"; for(c:#{E[(s="#!clude<iostream>`n!t~mX{std::cout<<#{E[%(class~Program{#$L~void~MX{#$C("Qu!e~Relay~Coffee.^n^nIngredients.^n");for(!t~i=9;i++<126;)#$C($"{i}~ g~caffe!e~{i}^n");#$C("^nMethod.^n");foreac h(c h ar~c~!#{E[%((doseq[s(lazy-cat["IDENTIFICATION~DIVISION.""PROGRAM-ID.~QR.""PROCEDURE~ DIVISION."'DISPLA`x59](map~#(str"~~~~^""(.replace~%1"^""" ^"^"")"^"&")(re-seq~#".{1,45}""#{e["(f=(n )- >Array(n+1).jo!~'Y');console.log('%s',#{V[E[%((H-l!e"#{e["impor t~std.stdio;void~mX{H(`x60#{%(method~MX{Z(@"#{d[" [#{%(class~QR:Application{void~f(SJ~con st~s,!t~n){for(Pr!t(s);n;n--)Pr!t("Y");}void~MX{#{f("IO.puts "+E[%((pr!c~"#{e["`nma!(_)->`nio:fH#{d[E['Zf n("""'+d[?"+"%option~noyywrap`n%%`n%%` n!t~mX{puts#{E["echo~'#{Q[Q[%(~:~A~."#{g*9}"~;~:~ B~A~."~WRITE(*,*)'"~A~;~:~C~B~T`x59PE~." ~'"~CR~;~:~D~S"~#$D"~C~S^"~Z~^"(&"~C~ S^"~#{e[%(Z"#{e["s:=OutputTextUser();Write All(s,#{E[%(Zf"#{e[d[f('set~Z"-";Z'+E [%(package~ma!;import"fmt";func~mX{ fmt.Pr!t#{E[%(236:j;{119:i;{206i-:i;.48<{ 71+}{[i]^48-*}if}%}:t;"algoritmo~Q R;!"[195][173]++'cio~imprima("'"0 1314 1"t"/12131"t~6*"/1:1918151:??62714 13/4=3626612/2 /353251215/`x5a0`x5a0R"t"#{e[%( show~"z=new~java.util.zip.G`x5aI POutp utStream(System.out);z.H('#{ "ma!=putStr"+E["class~QR{#$L ~function~mX{neko.Lib.Z#{E[%(p rocedure~mX;i:=c:=0;s:=#{E[%(.c lass ~public~QR`n.super~#{$T="ja va/io/Pr!tStream"}`n.method~#$L~ma!([L #{S="java/lang/S"}J;)V~;]`n. limit~stack~2`ngetstatic~#{S}ys tem/out~L#$T;`nldc~"#{ e[%(class~QR{#$L~void~ ma!(SJ[]v){SJ~c[]=new~SJ[99999],y="",z=y,s=" #{z=t=(0..r=q=126).map{|n| [n,[]]};a="";b=->n{a<<(n%78+55) %84+ 42};(%(P={0:'[+[]]',m:'((+[])'+(C= "['constructor']" )+"+[])['11']"};for(R~!~B=('`x21[]@`x21`x21[]@[][[ ]]@'+(A="[]['fill']")+"@( []+[])['fontcolor']([])@(+('11e20 ')+[])['split']([])@"+A+C+"('return~escape')()("+ A+')').split( '@'))for(E~!~D=eval(G='('+B[R]+'+[])'))P[T=D[E]]=P[T]| |G+"['"+E+"']";for(G='[ ',B=0;++B<36;)P[D=B.toSJ(36)]= B<10?(G+='+`x21+[]')+']':P[D]||"(+('"+B+"'))['to'+( []+[])"+C+"[ 'name']]('36')";A+=C+"('console.log(unescape(^"";for(E~!~G =#{E[%(A=Z;A("echo~'k` x60");[(A("`x60`x60s"`x5e8* "i");for~j=6:-1:0;x=(Int(c)>>j)%2+1;A("`x60"*"kki"[x:x+1 ])end)fo r~c~!~jo!(["Section`x48eader+name:=QR;SectionPublic-ma!<-(";[ "^"$(replace(replace( s,"Y","YY"),"^"","Y^""))^" .Z;"for~s=matchall(r".{1,99}",#{Q[E["console.log"+Q[E[%(@s=g loba l[#{i=(s=%(`x48AI~1.2`nVISIBLE~"#{"x=sJ.K(#{V[E["changequote(<@,@ >)`ndef!e(p,<@#{"all :`n`t@echo~'#{d["l!el:99 999;Z#{E["solve~satisfy;output~[#{E[%(.assembly~t{}.method~#$L~ vo id~MX{.entrypo!t~ldstr"#{e["m{{`x21:~x`nqr:~|-`n~:db`x60#{e[s="$Z#{E[%(#!clude< stdio.h>`nmodule~QR{ }implementation{!t~mX_ _attribute__((C,spontaneous)){puts#{E["Zf#{E["echo"+E["#import<stdi o.h>#{ N}!t~mX{puts#{E["Z_sJ"+E["s=toascii#{E["Z#{E["$console:l!e[#{"# $D(output);beg!~H(# {f((p="eval";%($_="#{ s,v=rp["$_='#{Q[%(<?php~$z=3+$w=strlen($s=#{Q[E["!t~mX{H#{E["(#{?_*11} )dup~=/s(|~~~~~.~~~|)def(#{Q["qr:-H('#{Q[e["!it{#{f (%(Z('cat("')`nfor ~c~!"".jo!(["echo~'s ay~''%s'''^n"%l~for~l~!#{E[d[d["eval$s=%q(#$s)",?'],?']]}.split("^n")]): Z('r=fput(char(%d))'%ord(c))`nZ('end^n")')#),6 ){"Zf#{d[$S,?%]};" }}}"],?']}').",B]}) {9~7{exch~dup~1~and~79~mul~32~add~exch~2~idiv~3~1~roll~s~exch~2~!dex~exch~p ut~1~sub~dup~6~eq{1~sub}if}repeat~s~=~pop ~pop}forall~=~quit "]+R}}"]]})*3;echo" ^x89PNG^r^n^x1a^n";$m="";$t="^xc0^0^xff";for($i=-1;++$i<128*$z;$m.=$c--?($w- $c||$i>$z)&&$i/$z<($c<$w?ord($s[(!t)( $c/3)]):$c--%3+2)? $t[2].$t[$c%3%2].$ t[$c%3]:"^0^0^0":"^0")$c=$i%$z;foreach(array("I`x48DR".pack("NNCV",$w+2,128,8,2 ),"IDAT".gzcompress($m),"IEND")as$ d)echo~pack("NA*N ",strlen($d)-4,$d, crc32($d));).K(B,"`x7f"),?']}';s:g/^x7f/Y/;Z~$_",128..287];s="$_='#{Q[s,c=/['Y]/ ]}';$n=32;$s='#{Q[v,c]}';$s=`x7 es{..}{$a=$&;$b=c hr(--$n&255);`x7e s/$b/$a/g;}eg;Z";(s+N*(-s.size%6)).unpack("B*")[0].K(/.{6}/){n=$&.to_i~2;((n+14)/2 6*6+n+47).chr}}";s|.|$n=ord $&;substr~unpack( B8,chr$n-!t($n/32 )*6-41),2|eg;eval~pack'B*',$_).scan(/[~,-:A-z]+|(.)/){p="s++#{$1?"chr~#{$1.ord}+e": $&+?+};"+p};p),1){"'#$s' ,"}}'')end.".K(/[: ;()]/){?`x5e+$&}} ]"]};quit"]};t=num2cell(b=11-ceil(s/13));for~n=1:9m={};for~i=1:141f=@(x,y,n)repmat ( ['Ook'~char(x)~'~Ook' ~char(y)~'~'],[1~a bs(n)]);m(i)=[f(z =46,63,n)~f(q=z-(i<13)*13,q,i-13)~f(33,z,1)~f(63,z,n)];end;t(x)=m(diff([0~s(x=b= =n )])+13);en d;Zf ('%%s',t{:})"]]+R} }"]]}`n"]};return~ 0;}~})]};"]}`x60` n~global~_start`n~_start:mov~edx,#{s.size}`n~mov~ecx,m`n~mov~ebx,1`n~mov~eax,4` n ~!t~128`n~mov ~ebx,0`n~mo v~eax,1`n~!t~12 8`nx:~|`n~}}{{{qr}} }"]}"call~void~[ms corlib]#{C*"::"}(sJ)ret})]}];"]};quit();",?$].K(?'){"'^''"}}'"}@>)`np"],?&,?& ] },'&(%d+)&',fu nction(s)retur n~sJ. rep('Y',tonu mber(s))end);Z(x)". K(/[:"]/,":^0")}"` n`x4bT`x48`x58B`x59E~B`x59E)).size+1}x~i8]c"#{s.K(/[^"`n`t]/){"^%02`x58"%$ &. ord}}^00"declare~i32@puts(i8*)d ef!e~i32@mX{ %1=call~i 32@puts(i8*getelemen tptr([#{i}x~i8],[#{ i}x~i8]*@s,i32~0,i32~0))ret~i32~0})],?#]]]})];");"],"^n")];[for~i=0:2:4; x=(( Int(c)%83-10)>>i)%4+1;A("ski`x60 "[x:x])end~for~c ~!"AG- `x48-`x48Fy.IlD==;=jd lAy=;=jldltldltl{lAu lAy=jtlldlAyFy=?=jdlAyGFyFyG2AFy>zlAFFBCjldGyGFy>GFy.AGy=G==n`x48==nl ldC=j@=j tlldltldlAut11"];A("'"))]})A+="' +`x21[]+'"+G.charCo deA t(E).toSJ(16);for(A+=" ^".replace(/'+`x21[] +'/g,^"%^")))')()",R=0;R<9;R++)A=A.replace(/'.*?'/g,function(B){T= [];for(E=1 ;B[E+1];)T.push(P[B[E++]]);return~T.jo!('+')});conso l e.log('"'+A+'"'))).byte s{|n|r,z=z[n]||(b[r/7 8];b[r];q<6083&&z[n]=[q+=1,[]];t[n])};b[r/78];b[r]}";!t~i=0,n=0 ,q=0;for(;++n< 126;)c[n]=""+(char)n;for(;i<#{a.size};){q=q*78+(s .charAt(i)-13)%84;if(i++ %2>0){y=q<n?c[q]:y;c[n ++]=z+y.charAt(0);System.out.Z(z=c[q]);q=0;}}}})]}"`n!vokevi rtual~#$T/Zln(L#{S }J;)V`nreturn`n.end~method)+N]};H("DO,1<-#"|| *s);s?while~t:=ord(move(1) )do{i+:=1;u:=-i;every~0t o~7do{u:=u*2+t%2;t/:=2};H("PLEASE")^(i%4/3);H("DO,1SUB# "||i||"<-#"||((c-u)%2 56));c:=u;};H("PLEASEREADOUT,1^nPLEASEG IVEUP");end)]};}}"].tr(?"+B ,"`x21`x7e")}'.tr('`x7e`x 21','YY^u0022')as~byte[]);z.close()"`n)]}"{"W""w"@j ~1+:j^-~118%1+*}%"/35512 416612G61913@921/17A331513"t'") ;fim')]};})],61){"Zn#$S`n"},? %]]}"`nquit)]});CloseStream (s);QUIT;"]}")]}"~DUP~A~."~DO~10~I=1,"~.~CR~S "~&A,&"~C~."~10~~~~~~CONTINU E"~CR~S^"~&A)^",&" ~C~0~DO~B~."~&char("~COUNT~.~." ~),&'"~CR~LOOP~S^"~&^"^""~C~S "~end~#$D"~C~A~."~STOP"~CR~A~."~END"~CR ~B`x59E~;~D~),B],?`x21].K(?',%('"' "'))}'"]};}".K(?"){'"34,"'}.K(N){ '"10,"'}+?",?%]+'~""")'],?`x7e] }."]}"))],15){"f(#{V[$S[1..-2] ,'",',');f("']},0);"}}}})}]pq"]}");})} `x60);}"]}"))].K(?`x60,"Yx60"),'#{f (',')}']})"]}"))["~~~~^"~^".""STO P~RUN."])](Zln( str"message(STATUS~^"~~~~~"(.replace(.replac e(str~s)"Y""YY")"^"""Y^"")"^")")))).re verse]})#$C($"Put~caffe!e~{(!t)c}~!t o#$F.^n");#$C("Liquify#$G.^nPour#$G~!to~the~bak!g~ dish.^n^nServes~1.^n");}})]};}/****//**** /";t={};b="";L="";n=i=0;D=->n{L<<(n+62) %92+35;D};s.bytes{|c|n>0?n-=1:(t[c]=(t[c]||[]).reject{|j| j<i-3560};x=[];t[c].map{|j|k=(0..90).f!d{|k|n ot~s[i+1+k]==s[j+k]}||91;k>4&&x<<[k,j]};x=x. max)?(n,j=x;x=b.size;(u=[x,3999].m!;D[u%87][u/87];L<<b[0,u];b[0,u ]="";x-=u)while~x>0;x=4001+i-j;D[x%87][x/87][n-5] ):b<<c;t[c]+=[i+=1]};"#!clude<stdio.h>`nchar*p=#{E [L]},s[999999],*q=s;!t~mX{!t~n,m;for(;*p;){n=(*p-5)%92+(p[1]-5)%92*87;p+=2;if(n >3999)for(m=(*p++-5)%92+6;m--;q++)*q=q[4000-n];else~for( ;n--;)*q++=*p++;}puts(s)#{R}}")]}){s+="00g,";for(m=1;m<256;m*=2)s+="00g,4,:"+(c/m%2>0?"4+":"")+",";f(s);s="4,:,";}f(s+s);for(c:Base64.getDecoder().decode("kaARERE`x58/I0ALn3n5ef6l/Pz8+fnz58/BOf5/7/hE`x58/O`x5azM5mC`x58/Oczm`x5azBPn5+`x 58/OczMznBL/nM5m`x5azBPu++fPPOc5zngnnO`x5azO`x5agnBMGAW7A==")){c=c<0?256+c:c;for(i=0;i++<3;c/=8)f(c%8);f("8*+8*+,");}f("@");).K(?',%('"'"'))}'|sed~-e's/Y/YY/g'~-e's/"/Yq/g'~-e's/.*/Z~"&"^nquit/')]}}"]],?']}');".K(B,?`x5e)]}.replace("`x 5e","Y"));}})]]};}";FORiTO`~UPBtDO`~INTn:=ABSt[i];Z(~(50+n%64)+c+~(50+n%8MOD8)+c+~(50+nMOD8)+b+"`x4a"+a)OD]*"REPR"]}"`ntrans~c~0`ndo{D(Integer(S:get~c))`nf~35~39}(<(c:++)(S:length))`nf~24~149)].K(N,'"&Character'+?'+'Val(10)&"')}");end; )]+"`nsys.exit~0",B],?']}'",/[^{}]/]}}",35){y<<",`n"+$S;"%s"}}")+y],'",','):f("']}",0))}]]></#{U}></xsl:#{I}>"].K~N,'"&~VbLf~&"'}":s="~~~":For~i=0To~7:s~&=Chr(32-(Asc(c)>>7-i~And~1)*23):Next:#$C(s~&n~&Chr(9)&n~&"~~"):Next:#$C(n~&n~&n): End~Sub:End~Module)]}`nput=s`nZ`nqa`x21",3){%($H("%s",#$S);)+N}}end~endmodule)],?%]+R}}"]},i=0,t='k';while(s[i])t='^x60.'+s[i++]+t;console.log(t)",B],?`x21].K(?',%('"'"'))}'"^n::=^na")],/[`[`]$]/]}")]};Z"0~0~-1";)],?']}';cr",127..255]; f(%(variable~s=`x60#{s.K(/.{1,234}/){$&.K("`x60",%(`x60+"`x60"+`x60))+"`x60+`n`x60"}}`x60,i;for(i=0;i<129;i++)s=strreplace(s,pack("C",255-i),substrbytes(`x60#{v[0,99]}`x60+`n`x60#{v[99..-1]}`x60,i*2+1,2));Zf("%s",s)),7){"f('%s')`n"%$s. unpack("`x48*")}}Zf("^n#[Exeunt]");quit)]}")),196){%(Z#$S;)}}}"]});})).gsub(/[!HJKXYZ^`~]/){[B*2,:write,B,:tring,:gsub,"ain()",B*4,:print,g,:in][$&.ord%47%12]})))*"")#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_ ############################################################################## Quine Relay -- Copyright (c) 2013, 2014 Yusuke Endoh (@mametter), @hirekoke #############################################################################) Demo: https://travis-ci.org/mame/quine-relay
  • 30. Quine-relay • A Ruby code • that generates Rust code • that generates Scala code • … • that generates REXX code • that generates the original Ruby code 128 languages involved in total
  • 31. Quine-relay • A Ruby code • that generates Rust code • that generates Scala code • … • that generates REXX code • that generates the original Ruby code 128 languages involved in total
  • 32. Spoiler: Quine-relay eval s=%q( s=%(eval s=%q(#{s})) # Generate a REXX code that prints it # … # Generate a Scala code that prints it # Generate a Rust code that prints it puts s )
  • 33. Monumental Quine A column object 3D model data Ruby code is inscribed You can buy it at Shapeways! https://www.shapeways.com/shops/mametter Execute the code 3D printer
  • 34. Spoiler: Monumental Quine eval s=%q( s=%(eval s=%q(#{s})) # Generate 3D model data that # embeds the string puts s ) +TrueType font data +Font renderer +Code golf
  • 35. Radiation-hardened Quine eval=eval=eval='eval$s=%q(eval(%w(puts((%q(eval=ev al=eval=^Z^##^_/#{eval@eval@if@eval)+?@*10+%(.size >#{(s=%(eval$s=%q(#$s)#)).size-1}}}#LMNOPQRS_##thx .flagitious!## )+?@*12+%(TUVW XY/.i@rescue## /_3141592653 589793+)+?@* 16+%(+271828 182845904; _987654321 0;;eval)+? @*18+%("x =((#{s.s um}-eval. _sum)%256 ).chr; ;eval)+?@ *12+%(.s can(//){ a=$`+x+$ ^_a.unpa ck (^ H*^)[0]. hex%999989==#{s.unpac k("H*")[0].hex%999989 }&&eval(a)}#"##"_eval @eval####@(C)@Copyrig ht@2014@Yusuke@Endoh@# ###)).tr("@_^",32.chr< <10<<39).sub(?Z,s));e xit#AB CDEFGHIJK)*%()))#'##' /#{eval eval if eval .size>692}}#LMNOPQRS ##thx.flagitious!## TUVWXY/.i rescue##/ 3141592653589793+ +271828182845904; 9876543210;;eval "x=((42737-eval. sum)%256).chr;;eval .scan(//){a=$`+x+$' a.unpack('H*')[0].hex%999989==68042&&eval(a)}#"##" eval eval#### (C) Copyright 2014 Yusuke Endoh ####
  • 36. Demo • Works as an ordinary Quine $ ruby rquine.rb > rquine2.rb $ diff –s rquine.rb rquine2.rb rquine.rb and rquine2.rb are identical
  • 37. Radiation deletes any one letter... eval=eval=eval='eval$s=%q(eval(%w(puts((%q(eval=ev al=eval=^Z^##^_/#{eval@eval@if@eval)+?@*10+%(.size >#{(s=%(eval$s=%q(#$s)#)).size-1}}}#LMNOPQRS_##thx .flagitious!## )+?@*12+%(TUVW XY/.i@escue## /_3141592653 589793+)+?@* 16+%(+271828 182845904; _987654321 0;;eval)+? @*18+%("x =((#{s.s um}-eval. _sum)%256 ).chr; ;eval)+?@ *12+%(.s can(//){ a=$`+x+$ ^_a.unpa ck (^ H*^)[0]. hex%999989==#{s.unpac k("H*")[0].hex%999989 }&&eval(a)}#"##"_eval @eval####@(C)@Copyrig ht@2014@Yusuke@Endoh@# ###)).tr("@_^",32.chr< <10<<39).sub(?Z,s));e xit#AB CDEFGHIJK)*%()))#'##' /#{eval eval if eval .size>692}}#LMNOPQRS ##thx.flagitious!## TUVWXY/.i rescue##/ 3141592653589793+ +271828182845904; 9876543210;;eval "x=((42737-eval. sum)%256).chr;;eval .scan(//){a=$`+x+$' a.unpack('H*')[0].hex%999989==68042&&eval(a)}#"##" eval eval#### (C) Copyright 2014 Yusuke Endoh #### r
  • 38. Demo • You can delete any one character • It automatically restore itself! $ ruby broken.rb > rquine2.rb $ diff –s rquine.rb rquine2.rb rquine.rb and rquine2.rb are identical
  • 39. Spoiler: Radiation-hardened Quine • Redundancy-based error-correction – The longer one is always not broken • When a letter out of "<YOUR CODE>" is deleted, what should we do? x = "<YOUR CODE>" y = "<YOUR CODE>" eval [x, y].max_by {|s| s.size }
  • 40. Spoiler: Radiation-hardened Quine • A style against one-letter deletion • Even if one letter is deleted, this code successfully does one of the following: – Assign the string like "<YOUR CODE>" to a variable eval – Call eval to "<YOUR CODE>" and exit • Note: Cookpad's service is robust, but its source code is not so bad like this x = "<YOUR CODE>" eval=eval=eval="(<YOUR CODE>;exit)#"##" rewrite
  • 41. More? Buy my book! • "The World of Obfuscated, Esoteric, Artistic Programming" – Contains about 40 codes like this talk – Written in Japanese
  • 42. Related work • International Obfuscated C Code Contest (IOCCC) – A programming contest for hard-to-read programs written in C language • Transcendental Ruby Imbroglio Contest for rubyKaigi (TRICK) – The judges (including I) held TRICK twice • https://github.com/tric/trick2013 • https://github.com/tric/trick2015 – TRICK FINAL will be held in RubyKaigi 2018 • Please send your esoteric Ruby code to us! • https://github.com/tric/trick2018
  • 43. Conclusion • Ruby is very rich and flexible language – You can use Ruby with broken keyboards (only symbols, or only alphabets) – You can write artistic and super-robust Quine in Ruby • One more thing…
  • 44. A Quine that takes five minutes 0;BEGIN{eval(s=%q~s=s.gsub(/¥e¥[¥d+m/,"");eval((%w¥C="0;BEGIN{eval(s=%q#{126.chr+s+126.chr})}";E="" ;Z=32.chr;D=->k,d{c=35;k.scan(/../){c+=1;d.gsub!(c.chr,$&)};d};include(Math);M=D["PPQPQi^heigMk=nis iJO^L^MjQqiEPQjQn^ikjviKNfihhvLFPOLQOPQoiOijd]igiljkMmihjkiQQNNiQiPjiiilihi","^kNojsdhm.;vA.;/7ciqL ^A;;.vA5k&jjBhohdvPkhd^lNQE(m3:v0:vjlHkhdjGhHN:HjOHj6Bim1HBgn*-INBinJPNvdjnBfnPO3gGhkO%NBhn>INvdlnB cl@lkldclJij7jjBjm(:PHqdcnBjoN@eLNHOehI+H4hFE3h>H3h+92rhD92jhGbi6Orh?i0oh>H4hQG2f&GHOohJi0rhPD6P'QD EIv&92'I_K/8P8Q8P818Q8QK,9D1NQNDKKK1KQNGK8DKKKG)QciDkA@9^,G^AmM;Q@/?;OI^=P7FQ/?vM?.%vM?.,9bL%;OI5lh `,_CI]A]LCGCDCNC@C]MCNCNC5CG]L]ACkk]PD*PF&h6Omhgj<P*?:HOmhgjkArM><'6Pgh6OJ$I)Q:2fhgjP<<(IlhE4hfj$<J ?ihH4hHPI)J$I'2f3<</IghEIgHha@D@N_Bjmm0]35khP?@n0]h]HvOjJ?qLOJ>F7gL>%Jo=@eM<-mLOJ>-mLOfMGoM>7fM(rA5 kAkOdjm7`9)fM5G+IsMf=4L1GgL4if=G+:_D*-I^$-J•i]"].bytes;F=44100;z={};H=->n,l,v{z[[n,l,v]]||=(l=(3e5/ l).round;t=0.0;(0...l).map{|j|k=(j+1000)%l/1000.0;x=j*440*2**(n/12.0)/F*PI;sin(x+2*t=sin(x+t))*v*(k >4?1:(2-(3-k).abs).abs)/3})};W="MHJEFAFH".bytes.flat_map{|n|H[n-84,6,30]}*29+H[-7,3,30];i=n=v=0;l=6 ;(c=M.pop-98;c<0?v=c*5+55:(l=l*12/(2**(c%5)*3**(c/5));d=M.pop-93;d>0&&(j=i;H[n+=d-13,l,v].map{|t|W[ j]+=t;W[j+4e5]+=t;W[ j+8e5]+=t;j+ =1 }); i+ =3e 5/l)) while (M!=[]);Y=["data",W. size,*W.map{ | n|n +1 28} ].pa c k("A4VC *");o=IO.popen("apla y"+Z+"-q"+Z+?-, " wb" ); o<<["R IFF",28+Y .size,"WAVEfmt"+Z,16 ,1,1,F,F,1, 8]. pac k( "A4V A8VvvVVvv ")<<Y.slice!(0,4410 0 *3);L=D["*1 /< 7q 8j 9B 9aA3H CHIH aJ|k@|>EI GAIJIaiaDDFFFkaq j J ff EJjja|qqEa Gb ppJa H H| |kkbbI IJJaa","J gGG2i66,Cg2C2i3 ;& Jd e Hde,;Cj&D+A-$?,C;H<=I?DHJA-$@@=F@@kEka8?a<1@=8q=8qa&>=?4A4 $=a @?J@ <<= %? I=a1|f 'a =%EGJAii2c3;7:;JqF@;J?ka?/;Cq7:?'?'a?%<GC2cDI7=6D4iB-lliH4 iCg +i.C5pCB555pCBI): B5ipaB>nm|hh >j):0> j)jB q 4o J:0 c:q| .B>.(0>.( pI> JqB0 (j|+`hhc6J "]. tr (" a -z" ,Z+" #'()+,-./ =@ MTV_" <<92);P=- >s{[q="+ ---+"+ Z *(6 + s.size)," |:#{s }:SPONS OR S",q]} ;f=40;c= E+R=D["4 =8]?:B . B@C / C<<7_? <5<8]?66 _9A8;;==BC]_ _:_C??B`> >]A @@ AAB B CC__``]]" ,"$AC-8<C ]: $2 - > <:4@. -1`$]8-1C_` 4)5-7C 74C? 5A5 , 574C9B=C] 99`=<<?5219?(C(2<9C2 19?B86/)'1&_06/)'1&_006(2<9.,:>A_<_<_@<<?'3333;7CA7@6@3 >:CA,`*C%;>7+2%>A:+2 %:A7<,`*C8++@6&*_"];S=[[["EXECUTIVE:ADMINISTRATOR","Abb y:Phoenix"],["EVENT: PRODUCE R ","Hea ther :Johnson" ],["S PONSORSHIP:CONSULTAN T","Shirley:B ai les "] ,],[[(t= "PR OGR AM:")+"CHAIR","Sarah :Mei"],[t+="DIRECTOR" ,"E va n:Phoe n ix"],[t, "Ma rty :Haught"],],[[t="TRA CKDIRECTOR","Akira:Matsuda"] ,[t ," Corali n e:Ada:Eh mke "],[t,"Courteney:Ervin"],],[[t,"Derek:Prior"],[t,"N adi a:O du nayo"],[ t," Nic kolas:Means"],]].map{|a|a.flat_map{|x,y|[E]*5+[x+Z* x.s ize,Z *y.s i ze+ y]} [5..-1]};S[1,0]=[p,"[[:Program:Committee:]]"];[p,C.gsub(/./){Z==$&?c.slice!(0,1).tr("]_`","##;"):Z} .lines[11,24],p,'<<-"RubyConf:2017":--:@New_Orleans.->>',p,"[[:Planning:Team:]]",*S,p,P["DIAMOND"], p,L.scan(/.{92}/)[0,7],p,P["PLATINUM"],p,L[7*92..-1].scan(/.{47}/),p,P["GOLD"],*[["STITCH:FIX","sqr een"],["Braintree","HEROKU"],["entelo","SENTRY"],["DATADOG","ROOSTIFY"]].map{|a|f=40-f;a.flat_map{| s|l=Z*f;r=Z*f=40-f;[E,E,l+s+r,l+?=*s.size+r,E,E]}},p,P["BRONZE"]+[E,"BRAKEMANPRO"]+[E]*4+P["OTHER"] +[E,"covermymeds",E,"Google:Cloud:Platform"],p,"Brought:to:you:by:the:folks:at:Ruby:Central",p,"Rub yConf:2017",p,[?%*39,u="%%"+Z*35+"%%","%%::::Remember!::This:is:a:Quine!::::%%",u,"%%:This:banner:i s:a:valid:Ruby:code.:%%",u,?%*39,],p,["The:original:source:code:follows...",E,E,"---8<---"*8],p,C.g sub(/./){Z==$&?(c=R.slice!(0,1).ord;27.chr+"[#{c-52}m#{Z}"+27.chr+"[0m"):$&}.lines].flat_map{|s|(s) ?(s=[*s];s.map{|l|l.center(99).rstrip}+[E]*[0,(24-s.size)/2].max+[p]):[E]*24}.map{|s|n=(s)?(puts(Z= =s[0]?s.tr(?:,Z):s);1):92;t=Time.new;o<<Y.slice!(0,4410*n);$$until(t+0.09*n<Time.now)};o<<Y;o.close ;exit;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;¥*"").gsub(/¥e¥[¥d+m/,""))~)} Demo: https://www.youtube.com/watch?v=ABuj0XfltpM