Ruby was initially designed to be a successor of the Perl programming language, which also means that it inherited a lot of Perl's expressiveness. To celebrate this, the TRIC¹ contest was invented:
- Write the most Transcendental, Imbroglio Ruby program!
- Illustrate some of the subtleties (and design issues) of Ruby!
- Show the robustness and portability of Ruby interpreters!
- Stabilize the spec of Ruby by the presence of valuable but unmaintainable code!
The best submissions were awarded at the Japanese Ruby Kaigi conference and also included in the Ruby source, for educational purpose. The winning submissions² of 2013 were:
¹ Transcendental Ruby Imbroglio Contest
² All code is MIT licensed, Copyright (c) 2013, TRICK Winners and Judges
1st Place: "Best pangram"
By kinaba (remarks)
The program prints each ASCII character from 0x20 ' ' to 0x7e '~' exactly once:
!@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz&[%r{\"}mosx,4>6]|?'while(putc 3_0-~$.+=9/2^5;)<18*7and:`#
While this would not be such a complicated thing to accomplish, reconsider the program after reading the second constraint!
The program contains each ASCII character from 0x20 ' ' to 0x7e '~' exactly once.
This is what it outputs:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~%
2nd Place: "Most Readable"
By Shinichiro Hamaji (remarks)
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
This program does exactly nothing, but nevertheless, it is all valid syntax!
3rd Place: "Most classic"
By Yusuke Endoh (remarks)
Guess what this one does:
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=%:
Jesu, Joy of Man's Desiring
Johann Sebastian Bach
#
| #
| #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | #
# # # #
| | | #
| #| #
# # | #
| | | #
| | # #
# # # #
| | # |
| | # #
# # # #
| | | #
| | #
# # # #
| | # |
| # # |
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| | # #
# # # #
| | | #
| # #
# # #
| | | #
| # | #
# # # #
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | :
Right! It will play some lovely classical music! Run it with:³
$ padsp ruby entry.rb
³ See Limitations for how to play it on Mac OS
Also See
Other Awarded Submissions
- "Worst Abuse of Constants - Dishonorable Mention" by Yutaka Hara (remarks)
- "Most Competitive" by Yusuke Endoh (remarks)
- "Best Way to Return true" by NAKAMURA Usaku (remarks)
- "Worst House of Garbage" by Nakamura Narihiro (hello_world.br, remarks)
- "Ruby by Ruby for Ruby Award" by Yutaka Hara (remarks)
- "Most Characteristic" by yoshi-taka (remarks)
- "Good Way to make Programs Wonderful" by baban (remarks)
More Idiosyncratic Ruby
- Please Comment on GitHub
- Next Article: Ruby TRICKS of 2015
- Previous Article: The Art of Arguments