in reply to (Golf) Decorating the Christmas Tree

well my first attempt came in at the same length as japhy's (109 chars, 98 excluding the setting of $h and $f):
($h,$f)=@_;for(1..$h){print' 'x($h-$_).($_==1?'*':join'',map{rand>$f?' +=':qw(* 0 @ +)[rand 4]}1..$_*2-1)."\n"}
... so i had no choice but to cheat. =) the following satisfies the rules strictly speaking, but only uses '0' as a decoration. it's 91 chars (or 80 excluding the setting of $h and $f).
($h,$f)=@_;for(1..$h){print' 'x($h-$_).($_==1?'*':join'',map{rand>$f?' +=':0}1..$_*2-1)."\n"}
of course japhy's entry could be modified similarly, thereby bringing us equal again.

oh well, as they say, cheaters never win.

- danboo

Replies are listed 'Best First'.
Re: Re: (Golf) Decorating the Christmas Tree
by danboo (Beadle) on Dec 03, 2001 at 23:11 UTC
    of course i just realized i could legally cut my chars down to 105 (94 excluding the setting of $h and $f) with:
    ($h,$f)=@_;print' 'x(--$h).($_==1?'*':join'',map{rand>$f?'=':qw(* 0 @ ++)[rand 4]}1..$_*2-1)."\n"for 1..$h
    - danboo
      And I can trim it to 88 (if we leave out the assignment):
      print$"x--$h.($_-1?join'',map{rand>$f?'=':qw (* 0 @ +)[rand 4]}1..$_*2-1:'*').$/for 1..$h

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

        print$"x--$h.($_<2?'*':join'',map{rand>$f?'=':qw(* 0 @ +)[rand 4]}2..$ +_*2).$/for 1..$h