From: David Balmain Date: 2005-11-21T16:08:22+09:00 Subject: Re: [QUIZ SOLUTION] Euchre Hands (#55) Got to get back to work. 166 chars; a=$<.readlines;s='dchs';c='AKQJT9';t=a.shift;u=(t[0]+32).chr;i=s.index(u);v=s[i-2].chr;puts t,a.sort_by{|k|(k=~/J[#{u+v}]/?0:50)+(s.index(k[1])-i)%4*10+c.index(k[0])} On 11/21/05, David Balmain wrote: > On 11/21/05, Pit Capitain wrote: > > David Balmain schrieb: > > > On 11/21/05, David Balmain wrote: > > >>Ryan, how about changing /(J#{u})|(J#{v})/ to /J[#{u}#{v}]/? That'll > > >>save you a couple more characters. :p > > > > > > Damn, now I can see why you did it that way. Sorry. Please disregard. > > > > No, your idea is right: he could still save one character using > > /J(#{u})|(#{v})/ > > > > Regards, > > Pit > > This is the last time I play golf. It's addictive and I should be working. > > a=$<.read.split("\n");s=%w{d c h > s};c='AKQJT9';t=a.shift;u=(t[0]+32).chr;i=s.index(u);v=s[i-2];w=[1];puts > t,a.sort_by{|k|(k=~/J[#{u+v}]/?0:99)+(s.index(k[1,1])-i)%4*10+c.index(k[0,1])} > > 184 characters. And this time I think it works. > >