in reply to Re: Golf: 3 hole golf game
in thread Golf: 3 hole golf game

And ripping off dragonchild's improvements on my human.pl, plus adding one improvement on your strategy we get to 94 characters:
@x=<>;print sort{$x{$a}cmp$x{$b}}map{($x{$_}=lc)=~s/\d+/0 x(length("@x")-length$&).$&/ge;$_}@x
Incidentally nice work on the select and shuffle problems. Marginally less efficient than my solution, but a lot shorter. (Well technically your solution is quadratic, but the quadratic bit has a small constant.)

Replies are listed 'Best First'.
Re^3: Golf: 3 hole golf game
by etcshadow (Priest) on Nov 17, 2004 at 21:10 UTC
    Nice.

    Was efficiency a requirement? If it was, then oops. Oh, well, I was optimizing for brevity.

    P.S. I wasn't able to inline the "@x" when I tried it (must be because I'm using a much older perl). I didn't throw in the $z="@x"; just to waste space. I was actually pretty disapointed at having to do so. Nice. I should really upgrade my perl (or at least have a more up-to-date version around).

    ------------ :Wq Not an editor command: Wq
      Brevity was indeed the requirement. I was just trying to make myself feel better. ;-)