Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ANN: 2005 International Obfuscated Ruby Code Contest (IORCC)

35 views
Skip to first unread message

Todd Nathan

unread,
Feb 21, 2005, 10:29:23 AM2/21/05
to
Dear Fellow Rubists,

My name is Todd Nathan, and it is with great pleasure
to annouce the opening of 2005 IORCC. The Official
International Obfuscated Ruby Code Contest Rules and
FAQ are now online. Please consider entering your
most obfuscated Ruby program, or becoming a judge.

The Official IORCC site: http://iorcc.dyndns.org/

Warm regards,

Todd Nathan
IORCC Founder/Judge
(SeaForth) irc://irc.freenode.net/
http://iorcc.dyndns.org/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Christian Neukirchen

unread,
Feb 23, 2005, 8:35:29 AM2/23/05
to
Bill Guindon <agor...@gmail.com> writes:

> On Wed, 23 Feb 2005 08:23:08 +0900, David A. Black <dbl...@wobblini.net> wrote:
>>
>> Is that "pretty" as in "somewhat", or "pretty" as in "nice-looking"?
>> :-)
>
> How about "pretty" and "pretty unreadable"?
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/124391

Don't tell me you can't read base64! :P

(It may be unreadable, but it isn't really obfuscated...)

> I'm still impressed by that one (obviously)

Well, thank you.

--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org


David A. Black

unread,
Feb 23, 2005, 8:52:06 AM2/23/05
to
Hi --

On Wed, 23 Feb 2005, Christian Neukirchen wrote:

> Matt Lawrence <ma...@technoronin.com> writes:
>
>> On Wed, 23 Feb 2005, Yukihiro Matsumoto wrote:
>>
>>> Well, it is a good chance to prove them we can write pretty unreadable
>>> code as well as readable code.
>>
>> There are already too many Ruby books that I can't read. :-)
>
> Now, "Ruby, the language where the documentation is more unreadable
> than the source" wouldn't be that good news, probably. :)

I think the books Matt is referring to are perfectly readable, if you
know Japanese :-)


David

--
David A. Black
dbl...@wobblini.net


Christian Neukirchen

unread,
Feb 23, 2005, 8:02:19 AM2/23/05
to
Josef 'Jupp' Schugt <ju...@gmx.de> writes:

> Todd Nathan wrote:
>> it is with great pleasure to annouce the opening of 2005 IORCC.
>

> 1st price: "Advanced Obfuscation: Perl for Ruby Programmers"
> 2nd price: "More Awkward Obfuscation: AWK for Ruby Programmers"
> 3rd price: "Obfuscation by Parenthesis: Lisp for Ruby Programmers"
> 4th price: "How to shoot yourself in the foot"
>
> An ORCC doesn't seem to be a good idea. I already hear them saying "See
> this? They keep on saying that Ruby code is much cleaner than Perl code.
> Don't believe their lies."

I wonder how the perl community reacted on books like "Object-oriented
Perl" by Conway... :P

Seriously, a deobfuscation contest of the winners is planned, too.

> Josef 'Jupp' Schugt

Alexander Kellett

unread,
Feb 22, 2005, 5:20:29 PM2/22/05
to
you're just annoyed cus you can't write crap code!
well i can! so let me at it! yay! yay me! etc. oh.
erm. ummm. la la la

Yukihiro Matsumoto

unread,
Feb 22, 2005, 6:07:49 PM2/22/05
to
Hi,

In message "Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC)"


on Wed, 23 Feb 2005 06:37:50 +0900, Josef 'Jupp' Schugt <ju...@gmx.de> writes:

|An ORCC doesn't seem to be a good idea. I already hear them saying "See
|this? They keep on saying that Ruby code is much cleaner than Perl code.
|Don't believe their lies."

Well, it is a good chance to prove them we can write pretty unreadable


code as well as readable code.

matz.


Bill Guindon

unread,
Feb 22, 2005, 6:42:46 PM2/22/05
to
On Wed, 23 Feb 2005 08:23:08 +0900, David A. Black <dbl...@wobblini.net> wrote:
> Hi --
> Is that "pretty" as in "somewhat", or "pretty" as in "nice-looking"?
> :-)

I'm still impressed by that one (obviously)

--
Bill Guindon (aka aGorilla)


Yukihiro Matsumoto

unread,
Feb 22, 2005, 8:08:01 PM2/22/05
to

In message "Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC)"
on Wed, 23 Feb 2005 08:23:08 +0900, "David A. Black" <dbl...@wobblini.net> writes:

|> Well, it is a good chance to prove them we can write pretty unreadable
|> code as well as readable code.
|
|Is that "pretty" as in "somewhat", or "pretty" as in "nice-looking"?
|:-)

Both, of course. I'm glad you've found the pun.

matz.


Shalev NessAiver

unread,
Feb 22, 2005, 7:05:16 PM2/22/05
to
WoW

Ochronus

unread,
Feb 22, 2005, 6:25:40 PM2/22/05
to
Josef 'Jupp' Schugt írta:

> Todd Nathan wrote:
>
>> it is with great pleasure to annouce the opening of 2005 IORCC.
>
>

> 1st price: "Advanced Obfuscation: Perl for Ruby Programmers"
> 2nd price: "More Awkward Obfuscation: AWK for Ruby Programmers"
> 3rd price: "Obfuscation by Parenthesis: Lisp for Ruby Programmers"
> 4th price: "How to shoot yourself in the foot"
>

> An ORCC doesn't seem to be a good idea. I already hear them saying "See
> this? They keep on saying that Ruby code is much cleaner than Perl code.
> Don't believe their lies."
>

> Josef 'Jupp' Schugt

Obfuscated codes promote exactly two things, not less, not more:
1, the flexibility of the target language
2, the talent and creativity of the author

I can only look up to those who write such high quality codes :) It does
not mean that they are
not capable to write clean, well-structured ones, on the contrary, most
of the times it shows their
deep understanding of both "sides".

For another point, any idea which puts ruby in the spotlight is more
than welcomed, I think, for
what ruby needs now more than anything else is popularity... and fun
around it, like this obfuscated
contest or the ruby quiz is exactly the thing for it - improving morale,
stirring up any still water, etc.


Regards,
Ochronus

Josef 'Jupp' Schugt

unread,
Feb 22, 2005, 4:37:50 PM2/22/05
to
Todd Nathan wrote:
> it is with great pleasure to annouce the opening of 2005 IORCC.

1st price: "Advanced Obfuscation: Perl for Ruby Programmers"


2nd price: "More Awkward Obfuscation: AWK for Ruby Programmers"
3rd price: "Obfuscation by Parenthesis: Lisp for Ruby Programmers"
4th price: "How to shoot yourself in the foot"

An ORCC doesn't seem to be a good idea. I already hear them saying "See
this? They keep on saying that Ruby code is much cleaner than Perl code.
Don't believe their lies."

Josef 'Jupp' Schugt
--
Currently running Aurox 10.1 Quicksilver.

Christian Neukirchen

unread,
Feb 23, 2005, 8:37:06 AM2/23/05
to
Matt Lawrence <ma...@technoronin.com> writes:

> On Wed, 23 Feb 2005, Yukihiro Matsumoto wrote:
>

>> Well, it is a good chance to prove them we can write pretty unreadable
>> code as well as readable code.
>

> There are already too many Ruby books that I can't read. :-)

Now, "Ruby, the language where the documentation is more unreadable
than the source" wouldn't be that good news, probably. :)

> -- Matt

David A. Black

unread,
Feb 22, 2005, 6:23:08 PM2/22/05
to
Hi --

On Wed, 23 Feb 2005, Yukihiro Matsumoto wrote:

Is that "pretty" as in "somewhat", or "pretty" as in "nice-looking"?
:-)


Alexander Kellett

unread,
Feb 23, 2005, 10:04:34 AM2/23/05
to
On Feb 23, 2005, at 2:02 PM, Christian Neukirchen wrote:
> I wonder how the perl community reacted on books like "Object-oriented
> Perl" by Conway... :P

as far as i can tell more people (e.g me) in the ruby community
have read books such as that than people in the perl community.

sad ain't it?

Alex

Sam Roberts

unread,
Feb 22, 2005, 6:12:00 PM2/22/05
to
Quoting ma...@ruby-lang.org, on Wed, Feb 23, 2005 at 08:07:49AM +0900:
> Hi,
>
> In message "Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC)"
> on Wed, 23 Feb 2005 06:37:50 +0900, Josef 'Jupp' Schugt <ju...@gmx.de> writes:
>
> |An ORCC doesn't seem to be a good idea. I already hear them saying "See
> |this? They keep on saying that Ruby code is much cleaner than Perl code.
> |Don't believe their lies."

Powerful languages allow obfuscation. Weak languages only allow garbage
code.

Anybody looking at the code in an obfuscated coding contest as an
example of how unreadable a language is severely misses the point.

Sam

Navindra Umanee

unread,
Feb 23, 2005, 10:26:31 AM2/23/05
to
Christian Neukirchen <chneuk...@gmail.com> wrote:
> > How about "pretty" and "pretty unreadable"?
> > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/124391
>
> Don't tell me you can't read base64! :P
>
> (It may be unreadable, but it isn't really obfuscated...)
>
> > I'm still impressed by that one (obviously)
>
> Well, thank you.

I agree, you did some really clever work, including a generator
script, but in the end it's base64 and the resulting Ruby code is very
readable.

I've seen people going around with a simple base64 encode/decode Ruby
line in their .signatures. It's just not impressive, people! :-)

Cheers,
Navin.


Matt Lawrence

unread,
Feb 22, 2005, 7:20:34 PM2/22/05
to
On Wed, 23 Feb 2005, Yukihiro Matsumoto wrote:

> Well, it is a good chance to prove them we can write pretty unreadable
> code as well as readable code.

There are already too many Ruby books that I can't read. :-)

-- Matt
Nothing great was ever accomplished without _passion_

io...@yahoo.com

unread,
Feb 23, 2005, 10:46:48 AM2/23/05
to
Dear Fellow Rubists,

The Official IORCC Rules and FAQ are now available online.

http://iorcc.dyndns.org/

Please consider entering, judging or promoting this Ruby event.

Matt Lawrence

unread,
Feb 23, 2005, 11:19:46 AM2/23/05
to
On Wed, 23 Feb 2005, Christian Neukirchen wrote:

> Matt Lawrence <ma...@technoronin.com> writes:
>
>> On Wed, 23 Feb 2005, Yukihiro Matsumoto wrote:
>>
>>> Well, it is a good chance to prove them we can write pretty unreadable
>>> code as well as readable code.
>>
>> There are already too many Ruby books that I can't read. :-)
>
> Now, "Ruby, the language where the documentation is more unreadable
> than the source" wouldn't be that good news, probably. :)

Personally, I find the book on Ruby Internals to be impossible for me to
read.

Christian Neukirchen

unread,
Feb 23, 2005, 11:34:45 AM2/23/05
to
Alexander Kellett <ruby-...@lypanov.net> writes:

Now, *that* would explain lots... }:-) Excellent book, btw.

> Alex

Christian Neukirchen

unread,
Feb 23, 2005, 11:40:13 AM2/23/05
to
Navindra Umanee <navi...@cs.mcgill.ca> writes:

How about:

puts [926381,23200231779,1299022,1045307475].map{|n|
n.to_s(?$).send n%9==0&&:to_s||:capitalize}.join(" ")<<","

My favorite stays:

s=",GreEkcaSh BODybuILDER ALBreChtAMMOonIa tSUNEMATsuJ";
puts lambda{|f|h=lambda{|h|lambda{|x|f[h[h]][x]}};h[h]}[
lambda{|f|lambda do|h|h[0]?f[h[1..-1]]<<h[0]:[];end}][s.
delete(*%w{A-Z ^JR})].#See King James text of the bible:
pack("c*")## "Y do ye not understand my speech?", John 8

> Cheers,
> Navin.
>

srand 52019;puts"Azzp!bljqkmw!Xrfy!nmgaiq!".
unpack(%q(c*)).map{|x|x^rand(16)}.pack('c*')

Brian Schröder

unread,
Feb 23, 2005, 12:56:17 PM2/23/05
to

On my machine:
$ uname -a
Linux silver.wg 2.6.9silver #1 Mon Jan 10 14:43:04 CET 2005 i686 GNU/Linux
$ ruby -v
ruby 1.8.2 (2005-01-10) [i386-linux]

That evaluates to:
$ ruby -e 'srand 52019;puts"Azzp!bljqkmw!Xrfy!nmgaiq!".
unpack(%q(c*)).map{|x|x^rand(16)}.pack("c*")'
Gwvz&baf|ej}%T{a|.ikhbcw)

And I thought it was about obfuscating the code, not the answer ;)

cheers,

Brian

--
Brian Schröder
http://ruby.brian-schroeder.de/

Christian Neukirchen

unread,
Feb 23, 2005, 1:08:34 PM2/23/05
to
Brian Schröder <ruby....@gmail.com> writes:

> On my machine:
> $ uname -a
> Linux silver.wg 2.6.9silver #1 Mon Jan 10 14:43:04 CET 2005 i686 GNU/Linux
> $ ruby -v
> ruby 1.8.2 (2005-01-10) [i386-linux]
>
> That evaluates to:
> $ ruby -e 'srand 52019;puts"Azzp!bljqkmw!Xrfy!nmgaiq!".
> unpack(%q(c*)).map{|x|x^rand(16)}.pack("c*")'
> Gwvz&baf|ej}%T{a|.ikhbcw)
>
> And I thought it was about obfuscating the code, not the answer ;)
>
> cheers,

Very interesting...

$ uname -a
Darwin lilith.local 7.8.0 Darwin Kernel Version 7.8.0: Wed Dec 22
14:26:17 PST 2004; root:xnu/xnu-517.11.1.obj~1/RELEASE_PPC Power
Macintosh powerpc
$ ruby -v
ruby 1.8.2 (2004-12-25) [powerpc-darwin7.7.0]

And it works. BTW, I've coded that on an Athlon XP on Kernel 2.6.0
with ruby 1.8.1...

Has the RNG changed recently?

> Brian

Martin DeMello

unread,
Feb 23, 2005, 1:29:31 PM2/23/05
to
Christian Neukirchen <chneuk...@gmail.com> wrote:
>
> My favorite stays:
>
> s=",GreEkcaSh BODybuILDER ALBreChtAMMOonIa tSUNEMATsuJ";
> puts lambda{|f|h=lambda{|h|lambda{|x|f[h[h]][x]}};h[h]}[
> lambda{|f|lambda do|h|h[0]?f[h[1..-1]]<<h[0]:[];end}][s.
> delete(*%w{A-Z ^JR})].#See King James text of the bible:
> pack("c*")## "Y do ye not understand my speech?", John 8

Very neat, though the "suJ" sequence gives it away.

martin

Navindra Umanee

unread,
Feb 23, 2005, 6:19:19 PM2/23/05
to
Brian Schröder <ruby....@gmail.com> wrote:
> That evaluates to:
> $ ruby -e 'srand 52019;puts"Azzp!bljqkmw!Xrfy!nmgaiq!".
> unpack(%q(c*)).map{|x|x^rand(16)}.pack("c*")'
> Gwvz&baf|ej}%T{a|.ikhbcw)
>
> And I thought it was about obfuscating the code, not the answer ;)

So ruby -e 'srand 52019; puts rand(16)' prints 6 for you, not 11?

Maybe it's only guaranteed to be deterministic on a particular
machine. Hey, I guess you ask for random, you get random!

Cheers,
Navin.

Navindra Umanee

unread,
Feb 23, 2005, 7:05:24 PM2/23/05
to
Christian Neukirchen <chneuk...@gmail.com> wrote:
> How about:

puts [1360991028827446, 591861].map{|n| n.to_s(?$
).send n%2==1&&:to_s||:capitalize}.join(" ")<<"!"

Very instructive, thanks!

Cheers,
Navin.


Navindra Umanee

unread,
Feb 23, 2005, 7:18:21 PM2/23/05
to
> puts [1360991028827446, 591861].map{|n| n.to_s(?$
> ).send n%2==1&&:to_s||:capitalize}.join(" ")<<"!"

Ugh. Thank god my horrible horrible typo is encoded and the whole
world can't see it. Everybody knows it's spelt 1360991042264374 not
1360991028827446!

At least the 50% chance it would still work properly with that fix
panned out...

Cheers,
Navin.

Dave Burt

unread,
Feb 23, 2005, 8:20:11 PM2/23/05
to

C:\WINDOWS>ruby -ve "srand 52019; puts rand(16)"
ruby 1.8.2 (2004-12-25) [i386-mswin32]
11

Mr. Schroeder's sig works fine here (Windows XP SP2). FWIW.

Cheers,
Dave


Lloyd Zusman

unread,
Feb 23, 2005, 8:57:43 PM2/23/05
to
ruby -e 'def x(n,m)z=n;(m-1).times{|x|z*=n};z;end
def f(n)d=2;r=[];while(d*d)<n do t=0;while((n%d)==0)do
n=(n/d).to_i;t+=1;end;while(t>0)do t-=1;r<<d;end;d+=(1+(d%2));end
(r<<n)if(n>1);r;end;p f((x(3,2).to_s+x(2,5).to_s).to_i).inject{
|x,y|x+y}.to_s.split(//).inject(1){|a,b|a*b.to_i}'

--
Lloyd Zusman
l...@asfast.com
God bless you.

Brian Schröder

unread,
Feb 24, 2005, 3:26:56 AM2/24/05
to

$ ruby -e 'srand 52019; puts rand(16)'
6

regards,

Christian Neukirchen

unread,
Feb 24, 2005, 9:24:42 AM2/24/05
to
Navindra Umanee <navi...@cs.mcgill.ca> writes:

>> puts [1360991028827446, 591861].map{|n| n.to_s(?$
>> ).send n%2==1&&:to_s||:capitalize}.join(" ")<<"!"

Why, thank you. :-)

> Ugh. Thank god my horrible horrible typo is encoded and the whole
> world can't see it. Everybody knows it's spelt 1360991042264374 not
> 1360991028827446!

:D

> Cheers,
> Navin.

Christian Neukirchen

unread,
Feb 24, 2005, 9:26:04 AM2/24/05
to
Lloyd Zusman <l...@asfast.com> writes:

> ruby -e 'def x(n,m)z=n;(m-1).times{|x|z*=n};z;end
> def f(n)d=2;r=[];while(d*d)<n do t=0;while((n%d)==0)do
> n=(n/d).to_i;t+=1;end;while(t>0)do t-=1;r<<d;end;d+=(1+(d%2));end
> (r<<n)if(n>1);r;end;p f((x(3,2).to_s+x(2,5).to_s).to_i).inject{
> |x,y|x+y}.to_s.split(//).inject(1){|a,b|a*b.to_i}'

Now, that's a lotta code to calculate 6*9. :-)

Caio Tiago Oliveira

unread,
Feb 24, 2005, 4:21:01 PM2/24/05
to
Brian Schröder, 24/2/2005 05:26:

11 for me (WinXP).

Josef 'Jupp' Schugt

unread,
Feb 24, 2005, 3:11:48 PM2/24/05
to
Christian Neukirchen wrote:
> I wonder how the perl community reacted on books like
> "Object-oriented Perl" by Conway... :P

"Who needs yet another way to do it?" I suppose.

Josef 'Jupp' Schugt

Josef 'Jupp' Schugt

unread,
Feb 24, 2005, 3:25:25 PM2/24/05
to
Alexander Kellett wrote:

> On Feb 22, 2005, at 10:37 PM, Josef 'Jupp' Schugt wrote:
>
>> An ORCC doesn't seem to be a good idea. I already hear them saying "See
>> this? They keep on saying that Ruby code is much cleaner than Perl code.
>> Don't believe their lies."
>
> you're just annoyed cus you can't write crap code!

It only seems more natural to use C for that. The following is a quick
and dirty hack to compute n! I wrote yesterday - without having
obfuscation in mind. It's simply my way of writing C. Blame it on my
tutorial - K&R.

#include <stdio.h>
#include <stdlib.h>
int main(int argc,char*argv[]){
unsigned long long i,fac;
for(i=fac=atoi(argv[1]);i>2;fac*=(--i));
return(printf("%ll\n",fac)==1);
}

To me Ruby is a tool for elegant solutions:

ruby -e 'puts (1..10).inject{|f,x| f*x}'

Josef 'Jupp' Schugt

Lloyd Zusman

unread,
Feb 24, 2005, 8:22:37 PM2/24/05
to
Christian Neukirchen <chneuk...@gmail.com> writes:

> Lloyd Zusman <l...@asfast.com> writes:
>
>> ruby -e 'def x(n,m)z=n;(m-1).times{|x|z*=n};z;end
>> def f(n)d=2;r=[];while(d*d)<n do t=0;while((n%d)==0)do
>> n=(n/d).to_i;t+=1;end;while(t>0)do t-=1;r<<d;end;d+=(1+(d%2));end
>> (r<<n)if(n>1);r;end;p f((x(3,2).to_s+x(2,5).to_s).to_i).inject{
>> |x,y|x+y}.to_s.split(//).inject(1){|a,b|a*b.to_i}'
>
> Now, that's a lotta code to calculate 6*9. :-)

Hey, this is nothing. They had a planet-sized computer working for
nearly 10 million years on that calculation.

Life ... don't talk to me about life ...

Alexander Kellett

unread,
Feb 25, 2005, 5:02:49 AM2/25/05
to
On Feb 24, 2005, at 11:30 PM, Josef 'Jupp' Schugt wrote:
> #include <stdio.h>
> #include <stdlib.h>
> int main(int argc,char*argv[]){
> unsigned long long i,fac;
> for(i=fac=atoi(argv[1]);i>2;fac*=(--i));
> return(printf("%ll\n",fac)==1);
> }

dunno why anyone would find that wierd...
you should see some of my c/c++ code with
method-template/class-template/macros mixes
it makes most c++ coders ask for explanations...

> To me Ruby is a tool for elegant solutions:

i think the point here is "to me"
to me ruby is a tool for having fun
while making useful stuff :)

Alex

Mathieu Bouchard

unread,
Feb 25, 2005, 7:38:56 AM2/25/05
to

On Wed, 23 Feb 2005, Bill Guindon wrote:

> On Wed, 23 Feb 2005 08:23:08 +0900, David A. Black <dbl...@wobblini.net> wrote:
> How about "pretty" and "pretty unreadable"?
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/124391
> I'm still impressed by that one (obviously)

Here's mine.

ruby -rrational -e'a=Rational(
0x9cc95b36d52d9fc20284574207b5f,0x622d297799f50876c38b460435956c
);(a=1/a;print((a.to_i+64).chr);a-=a.to_i)while a>0;puts'

ruby -e'x=2;p=[];(p<<x if !p.find{|y|x%y==0};x+=1)while
p.size<7;puts p.inject(0){|a,b|a+b*b}'

ruby -e'p (1..36).inject(0){|a,b|a+b}'

ruby -e'p (0..5).inject(0){|a,b|a+(1<<(11*b))}%691'

_____________________________________________________________________
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju


Jason Sweat

unread,
Feb 25, 2005, 7:49:39 AM2/25/05
to
On Fri, 25 Feb 2005 21:38:56 +0900, Mathieu Bouchard <ma...@sympatico.ca> wrote:
> ruby -e'p (1..36).inject(0){|a,b|a+b}'
>
> ruby -e'p (0..5).inject(0){|a,b|a+(1<<(11*b))}%691'

Looks like you are back to the drawing board with these last two in ruby 1.9:

$ ruby -e'p (1..36).inject(0){|a,b|a+b}'
-e:1: warning: don't put space before argument parentheses
1..36
-e:1: undefined method `inject' for nil:NilClass (NoMethodError)

$ ruby -e'p (0..5).inject(0){|a,b|a+(1<<(11*b))}%691'
-e:1: warning: don't put space before argument parentheses
0..5
-e:1: undefined method `inject' for nil:NilClass (NoMethodError)

$ ruby18 -e'p (1..36).inject(0){|a,b|a+b}'
666

$ ruby18 -e'p (0..5).inject(0){|a,b|a+(1<<(11*b))}%691'
666

Regards,
Jason
http://blog.casey-sweat.us/


Ville Mattila

unread,
Feb 25, 2005, 7:57:56 AM2/25/05
to
Jason Sweat <jason...@gmail.com> writes:
>
> $ ruby -e'p (1..36).inject(0){|a,b|a+b}'
> -e:1: warning: don't put space before argument parentheses
> 1..36
> -e:1: undefined method `inject' for nil:NilClass (NoMethodError)

Eliminating warning fixes things:

> /usr/local/ruby-1.9/bin/ruby -v -e'p((1..36).inject(0){|a,b|a+b})'
ruby 1.9.0 (2005-02-14) [sparc-solaris2.8]
666
same goes with the other test.

- Ville

Simon Strandgaard

unread,
Feb 25, 2005, 8:08:17 AM2/25/05
to
On Fri, 25 Feb 2005 21:49:39 +0900, Jason Sweat <jason...@gmail.com> wrote:
>
> $ ruby18 -e'p (1..36).inject(0){|a,b|a+b}'
> 666


'-NEON-EYE-'.unpack('C*').inject(0){|a,b|a+b} #-> 666

--
Simon Strandgaard (aka neoneye)


Florian Frank

unread,
Feb 25, 2005, 9:23:11 AM2/25/05
to
Simon Strandgaard wrote:

>'-NEON-EYE-'.unpack('C*').inject(0){|a,b|a+b} #-> 666
>
>

Ok, let's golf that down a bit, shall we? :)

'-NEON-EYE-'.sum

Brian Schröder

unread,
Feb 25, 2005, 11:30:00 AM2/25/05
to

Or even:

666

;)

0 new messages