in reply to (Golf) Decorating the Christmas Tree

Here's mine. Are we counting newlines in the character count? If not, I can format my function like so:
sub tree { # 1 2 3 #2345678901234567890123456789012 ($h,$f)=@_;@_=map$"x--$h.($_-1?0 x(2*$_-1):'*').$/,1..$h;s/0/rand >$f?'=':qw(0 @ * +)[rand 4]/eg for@_;print@_
That weighs in at 103.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: (Golf) Decorating the Christmas Tree
by Masem (Monsignor) on Dec 03, 2001 at 22:21 UTC
    Newlines should count if they're being used as whitespace separators like you've got in the last few lines (eg the qw list, or separating '/eg' and the following 'for'). But that would seem to only push your code up to 107 characters (3 spaces for the qw, another trailing '/eg'.

    I think in the general rules of golf, the character count should be as if the entire function was in one line of text. You can add CRs later, but the golf should still work if I did s/\n//g on it.

    -----------------------------------------------------
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
    "I can see my house from here!"
    It's not what you know, but knowing how to find it if you don't know that's important

      The count would be 109. You did not include the space needed between "0" and "x", nor the space needed between "rand" and "4".

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;