trick2013 results

Post on 12-Apr-2017

5.322 Views

Category:

Entertainment & Humor

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

TRICK 2013 Results

TRICK judges: @mametter, @eto, @shinh, @yhara,

@yukihiro_matz, leonid, @eban

What’s “TRICK”

• A contest for esoteric Ruby programming Ruby で変態度を競い合うプログラミングの祭典

cf. International Obfuscated C Code Contest (IOCCC)

• This talk dishonors the winners of TRICK 2013 本発表では TRICK 2013 入賞者の不名誉を讃え

• And demonstrates the winning entries さらに入賞作品のデモを紹介します

About the TRICK

What “TRICK” means

Transcendental Ruby Imbroglio Contest for RubyKaigi

• Transcendental /ˌtransɛnˈdɛnt(ə)l/

– “relating to a spiritual realm” 「霊界に関する」

– but it is translated as “unworldly technical” in Japanese なぜか日本語では「超絶技巧」と訳される

• ex. Transcendental Etudes (超絶技巧練習曲、Liszt)

• Imbroglio /ɪmˈbrəʊlɪəʊ/

– “an extremely confused, complicated, or embarrassing

situation” 極めて混乱した、複雑で、厄介な事態 adapted from

Oxford Dictionaries Online

Named by leonid

Goals of the TRICK

• Write the most Transcendental, Imbroglio Ruby program 現世利益のない、意味不明な Ruby プログラムを書く

• Illustrate some of the subtleties (and design issues) of

Ruby Ruby のある種の神秘性 (と仕様バグ) を明らかにする

• Show the robustness and portability of Ruby interpreters Ruby 処理系の意外な堅牢性と移植性を示す

• Stabilize the spec of Ruby by the presence of valuable but

unmaintainable code メンテナンス不能だが価値あるコードを世に放つことで Ruby の仕様を

安定化する

Related Contests

• IOCCC: International Obfuscated C Code Contest

• UCC: Underhanded C Contest

• OPC: Obfuscated Perl Contest

• IORCC: International Obfuscated Ruby Code Contest

1990 1995 2000 2005 2010 2013

C

Perl

Ruby

1985

IOCCC 1984-2006 2011 2012

UCC 2005-2009 2013

OPC 1996-2000

IORCC 2005 2012?

TRICK

2013

TRICK Contest Rules (1)

1. Your entry must be a complete Ruby program. あなたの作品は単体で動作する Ruby プログラムでなければならない。

2. The size of your program must be <= 4096 bytes in

length. The number of non-space characters must be <=

2048. The total size of your compressed submission

must be less than ten megabyte in size. あなたのプログラムのサイズは 4096 バイト以下でなければならない。非空白文字の数は 2048 以下でなければならない。あなたの投稿は zip

全体で 10 MB 未満でなければならない。

3. You can submit multiple entries, and your team may

consist of any number of members. あなたは何作でも作品を投稿できる、また、あなたのチームは何人であっても良い。

TRICK Contest Rules (2)

4. The entirety of your entry must be submitted under

MIT License. あなたの作品全体は MIT ライセンスで投稿されなければならない。

5. Your entry must bring the judges a surprise,

excitement, and/or laughter. あなたの作品は審査員に驚き、感動、(and/or)笑いを与えなければならない。

• Meta Rule: Rule Golf

– Too many restrictions may inhibit creativity あれこれ制約して作品の可能性を絞らないように

Guidelines (1): Ruby version/impl.

• Matz Ruby Implementation (MRI) 1.9/2.0 is

recommended. MRI 1.9/2.0 で動くことを推奨

• MRI 1.8 is highly discouraged because your entry

won't work in near future. 1.8 でしか動かないコードは強く非推奨

• You can use implementations other than MRI, such as

JRuby and Rubinius. MRI 以外の実装もOK

Guidelines (2): Library

• You can require a gem library. gem 使って OK

• But note that we will expect such entries to be much

more interesting than an entry that uses no library;

hence we will judge them strictly. ただしその分面白い作品であることが期待され、審査基準は厳しくなる

• It is highly discouraged to abuse gem to get around

the size limit. サイズ制限を回避するために gem を使うのは強く非推奨

Guidelines (3): Misc.

• The judges would prefer more stoic, more portable,

and/or more funny entries. ストイックで、様々な環境で動き、笑いのある作品が評価されやすい

• You are encouraged to examine the winners of

previous IOCCC contests. 過去の IOCCC の勝者を研究することを推奨する

• To judge without bias, we will try to keep each entry

anonymous during judgment. Do not include

anything that reveal your identity (such as a signature,

copyright, URL, etc.) in your program. 偏見なく審査できるよう、審査の間はすべての作品を匿名として扱うので、プログラムに作者がわかるような情報を含めないこと

Judges

Yusuke Endoh (@mametter)

Koichiro Eto (@eto)

Shinichiro Hamaji (@shinh)

Yutaka Hara (@yhara)

Yukihiro Matsumoto (@yukihiro_matz)

Sun Park a.k.a. leonid

Hirofumi Watanabe (@eban)

Judges

• mame

• eto

• shinh

• yhara

• matz

• leonid

• eban

– IOCCC winner

– Advocate for Transcendental programming.

– Media Artist.

– Chairman at NicoNicoGakkai Beta.

– The admin of anarchy golf.

– IOCCC winner.

– The author of Japanese esolang book.

– The creator of Ruby.

– The 1st super Ruby golfer in the anarchy golf.

– Ruby committer.

– The 2nd super Ruby golfer in the anarchy golf.

PR: Yusuke Endoh (@mametter)

• まじめな翻訳書

PR: Koichiro Eto (@eto)

• 「進化するアカデミア」

• ジュンク堂でも発売中

– サインします

PR: Yutaka Hara (@yhara)

• 「Rubyで作る奇妙な

プログラミング言語」 Making Esoteric

Language with Ruby

• 2013年秋~冬

電子化(+復刻!?)予定

Judging process

• Each judge scores each entry on 10 point scale 各審査員は各作品を 10 点満点で評価

– Each entry gains the average 平均点がスコア

• A judge has no right to score his own entry 自分の作品は審査対象外

• Judges keep each entry anonymous during judgment 審査員は作者を知らずに審査する

The winning entries of TRICK 2013

Summary

• 10 winning entries 入賞作品数: 10

– including “Top Four” for particularly high dishonors 上位4作品は特に不名誉を受ける

• Winning entries will be pushed automatically 入賞作品は時間になったら push されます

http://github.com/tric /trick2013/

Dishonorable

mention

No k!

“Good way to make programs

wonderful”

Winner:

mame leonid yhara eban shinh eto matz

4 6 6 5 6 5 6

baban

5.43

14:45:00 ← push 予定時刻

“Good way to make programs

wonderful” CONTEXT=->{

Alice.in.wonderland._ __ Alice.was.beginning_to.get.very._tired.of. her.sitting.by.her.sister.on.the.bank, and_.of.having.nothing.to.do, once.or.twice.she.had.peeped.into.the. book.her.sister.was.reading ...

“Good way to make programs

wonderful” – spoiler • Main trick: method_missing

• Eye-catching feature: Character status

---------------------------------------- character status ---------------------------------------- Alice : tired line:5 Alice : hear line:14 Alice : feet line:19 Alice : pop_down line:21 WhiteRabbit : ran line:12 WhiteRabbit : say line:15

“Most characteristic”

Winner:

mame leonid yhara eban shinh eto matz

7 8 7 1 9 7 1

yoshi-taka

5.71

14:48:30 ← push 予定時刻

“Most characteristic”

# coding: utf-8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def %Flipping Storm! (╯°□°)╯︵ ┻━ end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def print end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(以下掲載不能)

Execution result in os x

“Most characteristic” – spoiler

• Main trick: unicode phishing

– ‘NO-BREAK SPACE’ (U+00A0)

– ‘MINUS SIGN’ (U+2212)

– ‘RIGHT-TO-LEFT EMBEDDING’ (U+202B)

• Extra tricks:

– %%%%%%%

– Here document

– ß with ss

– Variable declaration by using defined?

– Weird remarks

• Down point: harmful output

“Ruby by Ruby for Ruby award”

Winner:

mame leonid yhara eban shinh eto matz

6 7 N/A 5 8 7 5

Yutaka Hara (judge)

5.83

14:52:00 ← push 予定時刻

“Ruby by Ruby for Ruby award”

... def Ruby RUBY::Ruby.ruby{|ruby| (ruby == :Ruby!) ? Ruby::RUBY : ruby.ruby.ruby.ruby.ruby{|ruby, _Ruby| ('Ruby'[_Ruby] == ruby) ? (2**_Ruby) : 0 }.RUBY(:+) }.ruby{|ruby| @@ruby[ruby]} end def ruby(ruby) ruby.Ruby(Ruby::Ruby).ruby{|ruby, _Ruby| _Ruby == "Ruby" ? ruby : -ruby }.ruby{|ruby| (ruby + RUBY::RUBY).ruby }._Ruby end ...

“Ruby by Ruby for Ruby award” –

spoiler • Main trick: aliasing

• Extra tricks:

– A method name “ruby” and variable name “ruby” coexist

– Dynamic typing hell

alias RUBY inject; alias _Ruby join; end class Fixnum; alias ruby chr; end class Symbol; alias ruby to_s; end class String; alias ruby chars; end class Enumerator; alias ruby with_index; end class Class; alias ruby new; end alias ruby puts

“Worst house of garbage”

Winner:

mame leonid yhara eban shinh eto matz

7 7 8 3 2 8 9

Nakamura Narihiro

6.29

14:55:30 ← push 予定時刻

“Worst house of garbage”

GC.disable Tape = ObjectSpace

Omitted because of normal appearance 見た目はつまんないので省略

Just a brainfuck interpreter, but… ただの brainfuck インタプリタです、が

“Worst house of garbage” – spoiler

• Main trick: abuse of ObjectSpace.each_object

• By exploiting this infinite loop, a brainfuck interpreter

is constructed この無限ループを利用して brainfuck 評価器を構成している

• Extra trick: history option

obj

yield!

object space

obj obj new

obj

new

obj

yield! yield! yield! yield!

new

obj

“Best way to return true”

Winner:

mame leonid yhara eban shinh eto matz

6 6 7 5 10 9 2

NAKAMURA Usaku

6.43

14:59:00 ← push 予定時刻

“Best way to return true”

• The whole code

$ruby.is_a?(Object){|oriented| language}

“Best way to return true”— spoiler

• Just executable, no feature at all 実行可能なだけ、一切の機能なし

Is the most Transcendental, Imbroglio Ruby program 現世利益のない、意味不明な Ruby プログラムである

• Exploits the fact that a method does not check if it

accepts block argument or not メソッドがブロック引数を受け付けるかどうかをチェックしないことを悪用

• Reveals a spec-level bug: missing is_an? is_an? がないという仕様バグを浮き彫りに

Shows some of the subtleties (and design issues) of

Ruby Ruby のある種の神秘性(と仕様バグ) を明らかにしている

“Best way to return true”— spoiler

• Works on almost all Ruby implementations ほぼすべてのRuby実装で実行可能

shows the robustness and portability of Ruby

interpreters Ruby 処理系の意外な堅牢性と移植性を示している

• This code returns true

$ruby.is_a?(Object){|oriented| language}

“Most competitive”

Winner:

mame leonid yhara eban shinh eto matz

N/A 7 8 6 4 7 8

Yusuke Endoh (judge)

6.67

15:02:30 ← push 予定時刻

“Most competitive”

• Yusuke Endoh

eval$s =(%q(;eval((%w(Z=" ¥s"*2;V="1sj6w3u1i kfyikb6y01xsjdceda j4".to _i(36);R=0..9;a,b= [[*$s.lines],[*$<] ].map{|s|n=0;1.ste p(w=s. map{|l|l.chomp.siz e}.max,2+3*m=48/(w -70)){|x|n=n*10+R. find{|n|R.al l?{|i| V[n*15 +i]<1= =Z<(s[ i/3*3+ 1][i%3*m+x]| |Z)}}} ;n};d= 10**(( b-a)/4 e2);[[ STDOUT,a+d=d *32/(d +1)],[ $stdou t,b-d] ].map{ |o,n|; s="eval$s=(%q("+$s [/(.*? ~){3}/ m];15. times{ |y|l=" %d"%(n+0.5);l=(l.b ytes.m ap{|c| (0..2) .map{| x|"x¥s "[V[c*15-720+y/3*3 +x]]*( 24/l.s ize)}* "";}*Z ).rstr ip.gsu b(?x){ s<<V.t o_s(20 );s.sl ice!(/ ¥S/)}; o.puts (y<14? l:l[0. .-4]+" ~))")} ;o.put s})*"" ));;%~ 7h7hhf 1j626e 0dh6392fa6b6b45iid c59c7h7hhf1j626e0d h6392fa6b6b45iidc5 9c7h7hhf1j626e0dh6 392fa6b6b45iidc59c 7h7hhf1j626e0dh639 2fa6b6b45iidc59c7h 7hhf1j626e0dh6392f a6b6b45iidc59c7h7h hf1j626e0dh6392fa6 b6b45iidc59c7h7hhf 1j626e0dh6392fa~))

“Most competitive” – spoiler

• A “battle quine system” based on Elo rating

• Main trick: Elo rating

– A way of calculating the relative skill levels of players

• Used in chess, shogi, etc.

– Each program represents its own rate

• Sub tricks: cheat OCR, abuse of -i

$ ruby alice.rb bob.rb == alice.rb beats bob.rb

$ ruby bob.rb ailce.rb == bob.rb beats alice.rb

Top Four

“Worst abuse of constants”

mame leonid yhara eban shinh eto matz

6 9 N/A 8 8 7 7

Yutaka Hara (judge)

Dishonorable

mention

7.50

15:06:00 ← push 予定時刻

“Worst abuse of constants”

def _(&b)$><<->(x){x ? (String===x ?x.upcase: (Class===x ? x : x.class).name[$a?0:($a=5)]): " "}[ begin b[];rescue Exception;$!;end ] end _ { return } _ { method(:p).unbind } _ { eval "{ " } _ { Thread.current.join } _ { nil } _ { select } _ { ruby } _ { self.class } ...

“Worst abuse of constants” –

spoiler • Main Trick: pick up characters from constant names

_ { return } LocalJumpError

_ { method(:p).unbind } UnboundMethod

_ { eval “{ “ } SyntaxError

_ { Thread.current.join } ThreadError

• Extra tricks

– Another U is picked from RUBY_COPYRIGHT

– JRuby fails to run this program

“Most classic”

mame leonid yhara eban shinh eto matz

N/A 8 10 5 7 10 7

Yusuke Endoh (judge)

7.83

15:09:30 ← push 予定時刻

“Most classic”

eval$C=%q(at_exit{ open("/dev/dsp","wb"){|g|h=[0]*80 $><<"¥s"*18+"eval$C=%q(#$C);S=%:" (S<<m=58).lines{|l|s=[128]*n=20E2 t=0; h.map!{|v|d=?!==l[ t]?1 :(l[ t]== ?#)? 0*v= 6:03 (v<1 ?[]: 0..n -1). each {|z| s[z] +=2* M.sin(($*[0] ||1) .to_f*M.sin(y= 40*(z+m)*2** (t/12E0)/463)+ y)*(v-z*d/n)}; t+=1;v-d};m+= n;g.flush<<(s. pack"C*"); puts(l)}}};M= Math);S=%:

“Most classic” – spoiler

• Main trick: music box with piano roll DSL

– # is a note, and | is a slur

• Extra tricks:

– “eval-split-join” idiom is not used

– Frequency modulation synthesis

FM 音源合成

• Judges’ comments

– boring

食傷気味

“Most readable”

mame leonid yhara eban shinh eto matz

9 8 9 9 N/A 7 5

Shinichiro Hamaji (judge)

7.83

15:13:00 ← push 予定時刻

“Most readable”

begin with an easy program. you should be able to write a program unless for you, program in ruby language is too difficult. At the end of your journey towards the ultimate program; you must be a part of a programming language. You will end if you != program

“Most readable” – spoiler

• Main trick:

– The whole structure is begin … end if false

– for statement is used for defining variables

begin ... ... unless for you, program in ... ... end ... end if you != program

begin with an easy program. you should be able to write a program unless for you, program in ruby language is too difficult. At the end of your journey towards the ultimate program; you must be a part of a programming language. You will end if you != program

“Best pangram”

mame leonid yhara eban shinh eto matz

8 9 10 10 10 7 8

kinaba

8.86

15:16:30 ← push 予定時刻

“Best pangram”

• The program prints each ASCII character from

0x20 ' ' to 0x7e '~' exactly once.

• The program contains each ASCII character from

0x20 ' ' to 0x7e '~' exactly once.

!@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz&[%r{¥"}mosx,4>6]|?'while(putc 3_0-~$.+=9/ 2^5;)<18*7and:`#

“Best pangram” – spoiler

• Trick:

– 32.upto(126) {|x| putc x }

– But cannot “declare and then use” variables

• Features

– $. global variable, the best friend of Ruby golfers

– Trash box of unused alphabets: THE QUICK BROWN …

– Quote characters

– Century puzzle-ish

!@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz&[%r{¥"}mosx,4>6]|?'while(putc 3_0-~$.+=9/ 2^5;)<18*7and:`#

Judges’ comments

• For winners 業務連絡

– Please come to the stage during the last demo 最後の解説中に受賞者の方は前に集まってください

Winning entries

• "Good way to make programs wonderful“ – baban

• “Most characteristic” – yoshi-taka

• “Best way to return true” – unak

• “Worst house of garbage” – Nakamura Narihiro

• “Ruby by Ruby for Ruby award” – Yutaka Hara

• “Most competitive” – Yusuke Endoh

Dishonorable Top Four

“Best pangram” – kinaba

“Most Readable” – Shinichiro Hamaji

“Most classic”– Yusuke Endoh

“Worst abuse of constants” – Yutaka Hara

Dishonorable

mention

Prize?

• Dishonor: the title of “insane” 不名誉: 「変態」の称号

• Top three entries will be included in the Ruby official

repository as “sample” programs 上位3作品はRuby公式リポジトリにコミットされます

– The next Ruby tarball will be released with them 次期 Ruby パッケージにも含まれた状態でリリースされます

Conclusion

• TRICK rules and winning entries:

https://sites.google.com/site/trickcontest2013/

• Future work

– Next contest?

– Please please submit your entry

– Really looking forward to entries from foreign!

top related